From b65bad18aa527684af999b5808a9087404c0759a Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Thu, 11 Jul 2019 14:31:55 +0430 Subject: [PATCH] [fuzz] Don't fail when blob is empty And enable more tests able to trig the issue. --- ...ase-minimized-hb-subset-fuzzer-5738978499624960 | Bin 0 -> 28 bytes test/fuzzing/hb-subset-fuzzer.cc | 2 +- test/fuzzing/run-subset-fuzzer-tests.py | 9 +++++---- 3 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5738978499624960 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 index 0000000000000000000000000000000000000000..0264a15fba26548d93bfdda5f5adfad82d0a3fb1 GIT binary patch literal 28 XcmZQzWME)mQ~(2a7gsk33qk?_C~gB; literal 0 HcmV?d00001 diff --git a/test/fuzzing/hb-subset-fuzzer.cc b/test/fuzzing/hb-subset-fuzzer.cc index 38e7ec6e..428765ea 100644 --- a/test/fuzzing/hb-subset-fuzzer.cc +++ b/test/fuzzing/hb-subset-fuzzer.cc @@ -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); } diff --git a/test/fuzzing/run-subset-fuzzer-tests.py b/test/fuzzing/run-subset-fuzzer-tests.py index 3ac22889..aa6301b0 100755 --- a/test/fuzzing/run-subset-fuzzer-tests.py +++ b/test/fuzzing/run-subset-fuzzer-tests.py @@ -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) -- GitLab