[fuzz] Don't fail when blob is empty
authorEbrahim Byagowi <ebrahim@gnu.org>
Thu, 11 Jul 2019 10:01:55 +0000 (14:31 +0430)
committerGitHub <noreply@github.com>
Thu, 11 Jul 2019 10:01:55 +0000 (14:31 +0430)
And enable more tests able to trig the issue.

test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5738978499624960 [new file with mode: 0644]
test/fuzzing/hb-subset-fuzzer.cc
test/fuzzing/run-subset-fuzzer-tests.py

diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5738978499624960 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5738978499624960
new file mode 100644 (file)
index 0000000..0264a15
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5738978499624960 differ
index 38e7ec6..428765e 100644 (file)
@@ -42,7 +42,7 @@ trySubset (hb_face_t *face,
     unsigned int bytes_count = 0;
     for (unsigned int i = 0; i < length; ++i)
       if (data[i]) ++bytes_count;
-    assert (bytes_count);
+    assert (bytes_count || !length);
 
     hb_blob_destroy (blob);
   }
index 3ac2288..aa6301b 100755 (executable)
@@ -33,7 +33,7 @@ def cmd(command):
                def timeout(p, is_killed):
                        is_killed['value'] = True
                        p.kill()
-               timer = threading.Timer (2, timeout, [p, is_killed])
+               timer = threading.Timer (5, timeout, [p, is_killed])
 
                try:
                        timer.start()
@@ -82,6 +82,8 @@ def run_dir (parent_path):
        global fails
        for file in os.listdir (parent_path):
                path = os.path.join(parent_path, file)
+               # TODO: Run on all the fonts not just subset related ones
+               if "subset" not in path: continue
 
                print ("running subset fuzzer against %s" % path)
                if valgrind:
@@ -91,7 +93,7 @@ def run_dir (parent_path):
                        if 'error' in text:
                                returncode = 1
 
-               if not valgrind and text.strip ():
+               if (not valgrind or returncode) and text.strip ():
                        print (text)
 
                if returncode != 0:
@@ -100,8 +102,7 @@ def run_dir (parent_path):
 
 
 run_dir (os.path.join (srcdir, "..", "subset", "data", "fonts"))
-# TODO running these tests very slow tests.  Fix and re-enable
-#run_dir (os.path.join (srcdir, "fonts"))
+run_dir (os.path.join (srcdir, "fonts"))
 
 if fails:
         print ("%i subset fuzzer related tests failed." % fails)