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

Behdad Esfahbod behdad at kemper.freedesktop.org
Sat Jun 2 00:19:15 UTC 2018


 README                           |    1 
 src/hb-private.hh                |    4 +-
 src/hb-set-private.hh            |    3 +-
 test/fuzzing/hb-subset-fuzzer.cc |   54 ++++++++++++++++++++++++---------------
 4 files changed, 39 insertions(+), 23 deletions(-)

New commits:
commit 4ca211bce192b01644c82f721251604df935b603
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jun 1 17:18:57 2018 -0700

    Fix hb_vector_size_t

diff --git a/src/hb-private.hh b/src/hb-private.hh
index 05f0adbe..74045d7e 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -549,7 +549,7 @@ _hb_ceil_to_4 (unsigned int v)
 
 /* Global nul-content Null pool.  Enlarge as necessary. */
 
-#define HB_NULL_POOL_SIZE 384
+#define HB_NULL_POOL_SIZE 264
 static_assert (HB_NULL_POOL_SIZE % sizeof (void *) == 0, "Align HB_NULL_POOL_SIZE.");
 
 #ifdef HB_NO_VISIBILITY
@@ -1153,7 +1153,7 @@ struct hb_vector_size_t
   union {
     elt_t v[byte_size / sizeof (elt_t)];
 #if HB_VECTOR_SIZE
-    typedef unsigned long vec_t __attribute__((vector_size (HB_VECTOR_SIZE)));
+    typedef unsigned long vec_t __attribute__((vector_size (HB_VECTOR_SIZE / 8)));
     vec_t vec[byte_size / sizeof (vec_t)];
 #endif
   } u;
diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index 323c6f4b..71688157 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -165,7 +165,6 @@ struct hb_set_t
     static inline unsigned int elt_get_max (const elt_t &elt) { return _hb_bit_storage (elt) - 1; }
 
     typedef hb_vector_size_t<elt_t, PAGE_BITS / 8> vector_t;
-    vector_t v;
 
     static const unsigned int ELT_BITS = sizeof (elt_t) * 8;
     static const unsigned int ELT_MASK = ELT_BITS - 1;
@@ -176,6 +175,8 @@ struct hb_set_t
     elt_t &elt (hb_codepoint_t g) { return v[(g & MASK) / ELT_BITS]; }
     elt_t const &elt (hb_codepoint_t g) const { return v[(g & MASK) / ELT_BITS]; }
     elt_t mask (hb_codepoint_t g) const { return elt_t (1) << (g & ELT_MASK); }
+
+    vector_t v;
   };
   static_assert (page_t::PAGE_BITS == sizeof (page_t) * 8, "");
 
commit a070dfd333f411bf720120eb332f7da93077054f
Author: Garret Rieger <grieger at google.com>
Date:   Thu May 31 16:47:39 2018 -0700

    [subset] Have the subset fuzzer pull the text string to subset to from the end of the fuzzer provided data.

diff --git a/test/fuzzing/hb-subset-fuzzer.cc b/test/fuzzing/hb-subset-fuzzer.cc
index 8bf6b4fa..c3703f2c 100644
--- a/test/fuzzing/hb-subset-fuzzer.cc
+++ b/test/fuzzing/hb-subset-fuzzer.cc
@@ -6,41 +6,55 @@
 
 #include "hb-subset.h"
 
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+
+void trySubset (hb_face_t *face,
+                const hb_codepoint_t text[],
+                int text_length,
+                bool drop_hints)
 {
-  hb_blob_t *blob = hb_blob_create ((const char *)data, size,
-                                    HB_MEMORY_MODE_READONLY, NULL, NULL);
-  hb_face_t *face = hb_face_create (blob, 0);
   hb_subset_profile_t *profile = hb_subset_profile_create ();
 
   hb_subset_input_t *input = hb_subset_input_create_or_fail ();
-  *hb_subset_input_drop_hints(input) = false;
+  *hb_subset_input_drop_hints(input) = drop_hints;
   hb_set_t *codepoints = hb_subset_input_unicode_set (input);
 
-  hb_subset_input_t *input_drop_hints = hb_subset_input_create_or_fail ();
-  *hb_subset_input_drop_hints(input_drop_hints) = true;
-  hb_set_t *codepoints_drop_hints = hb_subset_input_unicode_set (input);
-
-  const hb_codepoint_t text[] =
-      {
-        'A', 'B', 'C', 'D', 'E', 'X', 'Y', 'Z', '1', '2',
-        '3', '@', '_', '%', '&', ')', '*', '$', '!'
-      };
-  for (int i = 0; i < sizeof (text) / sizeof (hb_codepoint_t); i++)
+  for (int i = 0; i < text_length; i++)
   {
     hb_set_add (codepoints, text[i]);
-    hb_set_add (codepoints_drop_hints, text[i]);
   }
 
   hb_face_t *result = hb_subset (face, profile, input);
   hb_face_destroy (result);
 
-  result = hb_subset (face, profile, input_drop_hints);
-  hb_face_destroy (result);
-
   hb_subset_input_destroy (input);
-  hb_subset_input_destroy (input_drop_hints);
   hb_subset_profile_destroy (profile);
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+  hb_blob_t *blob = hb_blob_create ((const char *)data, size,
+                                    HB_MEMORY_MODE_READONLY, NULL, NULL);
+  hb_face_t *face = hb_face_create (blob, 0);
+
+  const hb_codepoint_t text[] =
+      {
+        'A', 'B', 'C', 'D', 'E', 'X', 'Y', 'Z', '1', '2',
+        '3', '@', '_', '%', '&', ')', '*', '$', '!'
+      };
+
+  trySubset (face, text, sizeof (text) / sizeof (hb_codepoint_t), true);
+  trySubset (face, text, sizeof (text) / sizeof (hb_codepoint_t), false);
+
+  hb_codepoint_t text_from_data[16];
+  if (size > sizeof(text_from_data)) {
+    memcpy(text_from_data,
+           data + size - sizeof(text_from_data),
+           sizeof(text_from_data));
+    unsigned int text_size = sizeof (text_from_data) / sizeof (hb_codepoint_t);
+    trySubset (face, text_from_data, text_size, true);
+    trySubset (face, text_from_data, text_size, false);
+  }
+
   hb_face_destroy (face);
   hb_blob_destroy (blob);
 
commit bb6f4adac70a161505953414aa85ba78cd993c65
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jun 1 16:30:38 2018 -0700

    Add Codacy badge

diff --git a/README b/README
index 6e213223..55775c8b 100644
--- a/README
+++ b/README
@@ -2,6 +2,7 @@
 [![Build status](https://ci.appveyor.com/api/projects/status/0t0flrxpstj9lb9w?svg=true)](https://ci.appveyor.com/project/harfbuzz/harfbuzz)
 [![CircleCI](https://circleci.com/gh/harfbuzz/harfbuzz.svg?style=svg)](https://circleci.com/gh/harfbuzz/harfbuzz)
 [![Coverity](https://img.shields.io/coverity/scan/5450.svg)](https://scan.coverity.com/projects/behdad-harfbuzz)
+[![Codacy Badge](https://api.codacy.com/project/badge/Grade/f17f1708783c447488bc8dd317150eaa)](https://app.codacy.com/app/behdad/harfbuzz)
 [![Coverage Status](https://img.shields.io/coveralls/harfbuzz/harfbuzz.svg)](https://coveralls.io/r/harfbuzz/harfbuzz)
 [ABI Tracker](http://abi-laboratory.pro/tracker/timeline/harfbuzz/)
 


More information about the HarfBuzz mailing list