[HarfBuzz] harfbuzz: Branch 'master' - 6 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Oct 18 04:47:10 UTC 2018


 dev/null                                                                           |binary
 src/hb-aat-layout-common.hh                                                        |   23 +++++-
 src/hb-static.cc                                                                   |    4 +
 test/fuzzing/fonts/clusterfuzz-testcase-hb-shape-fuzzer-5634395566768128           |binary
 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5718464350650368 |binary
 test/fuzzing/run-shape-fuzzer-tests.py                                             |   38 ++++++++--
 util/options.cc                                                                    |    2 
 7 files changed, 59 insertions(+), 8 deletions(-)

New commits:
commit 9e8a9b846ec24e9124d61706272a0e5fa58d7a24
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Oct 17 21:41:25 2018 -0700

    [aat] Another try at fixing Lookup null objects...
    
    Ugly as hell, and don't even understand why some bits are needed.
    But the logic is sound.

diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index 37f6d03c..741e5020 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -291,10 +291,27 @@ struct Lookup
   LookupFormat8<T>	format8;
   } u;
   public:
-  DEFINE_SIZE_MIN (0); /* 0 min size, makes sure this cannot be used on null pool,
-			* because Format0 has unbounded size depending on num_glyphs.
-			* We cannot define custom null bytes for a template :(. */
+  DEFINE_SIZE_UNION (2, format);
 };
+/* Lookup 0 has unbounded size (dependant on num_glyphs).  So we need to defined
+ * special NULL objects for Lookup<> objects, but since it's template our macros
+ * don't work.  So we have to hand-code them here.  UGLY. */
+} /* Close namespace. */
+/* Ugly hand-coded null objects for template Lookup<> :(. */
+extern HB_INTERNAL const unsigned char _hb_Null_AAT_Lookup[2];
+template <>
+/*static*/ inline const AAT::Lookup<OT::HBUINT16>& Null<AAT::Lookup<OT::HBUINT16> > (void) {
+  return *reinterpret_cast<const AAT::Lookup<OT::HBUINT16> *> (_hb_Null_AAT_Lookup);
+}
+template <>
+/*static*/ inline const AAT::Lookup<OT::HBUINT32>& Null<AAT::Lookup<OT::HBUINT32> > (void) {
+  return *reinterpret_cast<const AAT::Lookup<OT::HBUINT32> *> (_hb_Null_AAT_Lookup);
+}
+template <>
+/*static*/ inline const AAT::Lookup<OT::Offset<OT::HBUINT16, false>>& Null<AAT::Lookup<OT::Offset<OT::HBUINT16, false>> > (void) {
+  return *reinterpret_cast<const AAT::Lookup<OT::Offset<OT::HBUINT16, false>> *> (_hb_Null_AAT_Lookup);
+}
+namespace AAT {
 
 
 /*
diff --git a/src/hb-static.cc b/src/hb-static.cc
index 5112d77b..0b92443e 100644
--- a/src/hb-static.cc
+++ b/src/hb-static.cc
@@ -41,6 +41,10 @@ hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_
 DEFINE_NULL_NAMESPACE_BYTES (OT, Index) =  {0xFF,0xFF};
 DEFINE_NULL_NAMESPACE_BYTES (OT, LangSys) = {0x00,0x00, 0xFF,0xFF, 0x00,0x00};
 DEFINE_NULL_NAMESPACE_BYTES (OT, RangeRecord) = {0x00,0x01, 0x00,0x00, 0x00, 0x00};
+/* Hand-coded because Lookup is a template.
+ * Not sure why I need the extern "C" :(.
+ * Sad. */
+extern "C" HB_INTERNAL const unsigned char _hb_Null_AAT_Lookup[2] = {0xFF, 0xFF};
 
 
 void
commit 191eef823fe95355425621f8e002dfe7fe632383
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Thu Oct 18 08:04:18 2018 +0330

    [test] Remove not-fixed yet testcases (#1268)
    
    I added them but now that I think, it is a bad idea to have them as
    fuzzing bots will find good seeds to tweak in order to find easy new
    testcases which causes duplicated issues.

diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4548492505645056 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4548492505645056
deleted file mode 100644
index 065080f3..00000000
Binary files a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4548492505645056 and /dev/null differ
diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6210176798425088 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6210176798425088
deleted file mode 100644
index 1c62961e..00000000
Binary files a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6210176798425088 and /dev/null differ
diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5738888765636608 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5738888765636608
deleted file mode 100644
index 28e72df7..00000000
Binary files a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5738888765636608 and /dev/null differ
commit 392e1f4ddd7eb649e1a71755b9bcf6431739f98f
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Thu Oct 18 07:42:20 2018 +0330

    [test/shape-fuzzer] fail on timeout and ubsan errors (#1267)

diff --git a/test/fuzzing/run-shape-fuzzer-tests.py b/test/fuzzing/run-shape-fuzzer-tests.py
index 074ecc8e..8fadd167 100755
--- a/test/fuzzing/run-shape-fuzzer-tests.py
+++ b/test/fuzzing/run-shape-fuzzer-tests.py
@@ -2,7 +2,36 @@
 
 from __future__ import print_function, division, absolute_import
 
-import sys, os, subprocess
+import sys, os, subprocess, tempfile, threading
+
+
+def cmd(command):
+	# https://stackoverflow.com/a/4408409
+	# https://stackoverflow.com/a/10012262
+	with tempfile.TemporaryFile() as tempf:
+		p = subprocess.Popen (command, stderr=tempf)
+		is_killed = {'value': False}
+
+		def timeout(p, is_killed):
+			is_killed['value'] = True
+			p.kill()
+		timer = threading.Timer (2, timeout, [p, is_killed])
+
+		try:
+			timer.start()
+			p.wait ()
+			tempf.seek (0)
+			text = tempf.read().decode ("utf-8").strip ()
+			returncode = p.returncode
+		finally:
+			timer.cancel()
+
+		if is_killed['value']:
+			text = 'error: timeout, ' + text
+			returncode = 1
+
+		return text, returncode
+
 
 srcdir = os.environ.get ("srcdir", ".")
 EXEEXT = os.environ.get ("EXEEXT", "")
@@ -24,10 +53,11 @@ parent_path = os.path.join (srcdir, "fonts")
 for file in os.listdir (parent_path):
 	path = os.path.join(parent_path, file)
 
-	p = subprocess.Popen ([hb_shape_fuzzer, path])
+	text, returncode = cmd ([hb_shape_fuzzer, path])
+	print (text)
 
-	if p.wait () != 0:
-		print ('failure on %s', font)
+	if returncode != 0 or 'error' in text:
+		print ('failure on %s' % file)
 		fails = fails + 1
 
 if fails:
commit eeddda3ec6c28b411d33c74938ec6198c7f6888d
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Thu Oct 18 07:38:47 2018 +0330

    [util] Better file-not-found error from hb-shape / hb-view
    
    fixes #1266

diff --git a/util/options.cc b/util/options.cc
index 26b0bd0a..5661cd05 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -660,7 +660,7 @@ font_options_t::get_font (void) const
   blob = hb_blob_create_from_file (font_path);
 
   if (blob == hb_blob_get_empty ())
-    fail (false, "No such file or directory");
+    fail (false, "Couldn't read or find %s, or it was empty.", font_path);
 
   /* Create the face */
   hb_face_t *face = hb_face_create (blob, face_index);
commit 751c10e55e43e2266a5bba024d560c5127fae4b8
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Thu Oct 18 06:36:48 2018 +0330

    [fuzz] Add more new testcases

diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5718464350650368 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5718464350650368
new file mode 100644
index 00000000..d511e9d1
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5718464350650368 differ
diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5738888765636608 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5738888765636608
new file mode 100644
index 00000000..28e72df7
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5738888765636608 differ
commit fd282eb3285e6d20f77e8a3a7237b677433ccbb4
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Thu Oct 18 06:33:39 2018 +0330

    [fuzz] Add a new testcase

diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-hb-shape-fuzzer-5634395566768128 b/test/fuzzing/fonts/clusterfuzz-testcase-hb-shape-fuzzer-5634395566768128
new file mode 100644
index 00000000..cd1a2934
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-hb-shape-fuzzer-5634395566768128 differ


More information about the HarfBuzz mailing list