[HarfBuzz] harfbuzz: Branch 'master' - 13 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Fri Oct 19 17:17:14 UTC 2018
.circleci/config.yml | 17 +
BUILD.md | 2
CMakeLists.txt | 8
README.python.md | 2
README.wine.md | 6
src/Makefile.am | 4
src/hb-aat-layout-kerx-table.hh | 8
src/hb-common.cc | 2
src/hb-coretext.cc | 4
src/hb-machinery.hh | 2
src/hb-map.hh | 2
src/hb-null.hh | 4
src/hb-open-file.hh | 2
src/hb-ot-layout-common.hh | 2
src/hb-ot-layout-gdef-table.hh | 2
src/hb-ot-layout-gpos-table.hh | 2
src/hb-ot-layout-gsub-table.hh | 2
src/hb-ot-layout-gsubgpos.hh | 4
src/hb-ot-tag.cc | 2
src/hb-shape-plan.cc | 8
test/api/Makefile.am | 10
test/api/test-map.c | 117 ++++++++++
test/api/test-ot-name.c | 18 -
test/api/test-set.c | 3
test/fuzzing/fonts/clusterfuzz-testcase-hb-shape-fuzzer-5728971283496960 |binary
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5713868010553344 |binary
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6278851874258944 |binary
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5649959857160192 |binary
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5664873493561344 |binary
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5762953198960640 |binary
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5764636557705216 |binary
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5690658895953920 |binary
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5695279609675776 |binary
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5718215406125056 |binary
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5743250149736448 |binary
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5765071062958080 |binary
test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-get-codepoints-fuzzer-5930139383758848 |binary
test/fuzzing/hb-shape-fuzzer.cc | 42 +--
test/fuzzing/run-shape-fuzzer-tests.py | 31 ++
39 files changed, 240 insertions(+), 66 deletions(-)
New commits:
commit 2352cc3539b2e58d0481cdb8b9cd48cbc09a778e
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Oct 19 09:58:45 2018 -0700
[kerx] Whitespace
diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index c09a6d31..9727e396 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -143,12 +143,12 @@ struct KerxSubTableFormat1
if (flags & Reset)
{
- depth = 0;
+ depth = 0;
}
if (flags & Push)
{
- if (likely (depth < ARRAY_LENGTH (stack)))
+ if (likely (depth < ARRAY_LENGTH (stack)))
stack[depth++] = buffer->idx;
else
depth = 0; /* Probably not what CoreText does, but better? */
@@ -157,14 +157,14 @@ struct KerxSubTableFormat1
if (entry->data.kernActionIndex != 0xFFFF)
{
const FWORD *actions = &kernAction[entry->data.kernActionIndex];
- if (!c->sanitizer.check_array (actions, depth))
+ if (!c->sanitizer.check_array (actions, depth))
{
depth = 0;
return false;
}
hb_mask_t kern_mask = c->plan->kern_mask;
- for (unsigned int i = 0; i < depth; i++)
+ for (unsigned int i = 0; i < depth; i++)
{
/* Apparently, when spec says "Each pops one glyph from the kerning stack
* and applies the kerning value to it.", it doesn't mean it in that order.
commit 114f66dda6a07d61b5e64da5c44b05db7aa51cc9
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date: Fri Oct 19 12:05:26 2018 +0330
Fix hb_map_is_empty logic
This needs reviewing
diff --git a/src/hb-map.hh b/src/hb-map.hh
index 21898a7a..b55e3a95 100644
--- a/src/hb-map.hh
+++ b/src/hb-map.hh
@@ -172,7 +172,7 @@ struct hb_map_t
inline bool is_empty (void) const
{
- return population != 0;
+ return population == 0;
}
inline unsigned int get_population () const
diff --git a/test/api/test-map.c b/test/api/test-map.c
index 86827180..a89feaa4 100644
--- a/test/api/test-map.c
+++ b/test/api/test-map.c
@@ -31,20 +31,20 @@ static void
test_map_basic (void)
{
hb_map_t *empty = hb_map_get_empty ();
- g_assert (!hb_map_is_empty (empty)); /* this feels wrong */
+ g_assert (hb_map_is_empty (empty));
g_assert (!hb_map_allocation_successful (empty));
hb_map_destroy (empty);
hb_map_t *m = hb_map_create ();
g_assert (hb_map_allocation_successful (m));
- g_assert (!hb_map_is_empty (m)); /* this as well */
+ g_assert (hb_map_is_empty (m));
hb_map_set (m, 213, 223);
hb_map_set (m, 643, 675);
g_assert_cmpint (hb_map_get_population (m), ==, 2);
g_assert_cmpint (hb_map_get (m, 213), ==, 223);
- g_assert (hb_map_get (m, 123) == -1);
+ g_assert (!hb_map_has (m, 123));
g_assert (hb_map_has (m, 213));
hb_map_del (m, 213);
@@ -94,12 +94,14 @@ test_map_refcount ()
hb_map_t *m2 = hb_map_reference (m);
hb_map_destroy (m);
+
+ /* We copied its reference so it is still usable after one destroy */
g_assert (hb_map_has (m, 213));
g_assert (hb_map_has (m2, 213));
hb_map_destroy (m2);
- g_assert (hb_map_has (m, 213)); /* shouldn't these return false? */
- g_assert (hb_map_has (m2, 213));
+
+ /* Now you can't access them anymore */
}
int
@@ -109,6 +111,7 @@ main (int argc, char **argv)
hb_test_add (test_map_basic);
hb_test_add (test_map_userdata);
+ hb_test_add (test_map_refcount);
return hb_test_run();
}
commit 9df2fb1611e03e401f0d5a9432b440641085ba1e
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date: Fri Oct 19 12:04:47 2018 +0330
Add API tests for hb_map_t
diff --git a/src/Makefile.am b/src/Makefile.am
index b2b9ad54..e0ea1c5d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -269,7 +269,7 @@ EXTRA_DIST += \
CLEANFILES += $(pkgconfig_DATA)
-DEF_FILES = harfbuzz.def harfbuzz-subset.def harfbuzz-icu.def
+DEF_FILES = harfbuzz.def harfbuzz-subset.def harfbuzz-icu.def harfbuzz-deprecated.def
if HAVE_GOBJECT
DEF_FILES += harfbuzz-gobject.def
endif
diff --git a/test/api/Makefile.am b/test/api/Makefile.am
index 2a50148a..45a34e64 100644
--- a/test/api/Makefile.am
+++ b/test/api/Makefile.am
@@ -33,6 +33,7 @@ TEST_PROGS = \
test-collect-unicodes \
test-common \
test-font \
+ test-map \
test-object \
test-set \
test-shape \
@@ -174,7 +175,10 @@ symbols-exported.txt: $(top_builddir)/src/.libs/libharfbuzz.so
| sort | uniq > $@.tmp && mv $@.tmp $@
symbols-untested.txt: symbols-tested-or-deprecated.txt symbols-exported.txt
$(AM_V_GEN)diff $^ > $@.tmp; mv $@.tmp $@
-CLEANFILES += symbols-tested.txt symbols-exported.txt symbols-untested.txt
+CLEANFILES += symbols-tested.txt \
+ symbols-exported.txt \
+ symbols-untested.txt \
+ symbols-tested-or-deprecated.txt
check-symbols: symbols-untested.txt
@! cat $^ | grep .
diff --git a/test/api/test-map.c b/test/api/test-map.c
new file mode 100644
index 00000000..86827180
--- /dev/null
+++ b/test/api/test-map.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright © 2018 Ebrahim Byagowi
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ */
+
+#include "hb-test.h"
+
+/* Unit tests for hb-map.h */
+
+
+static void
+test_map_basic (void)
+{
+ hb_map_t *empty = hb_map_get_empty ();
+ g_assert (!hb_map_is_empty (empty)); /* this feels wrong */
+ g_assert (!hb_map_allocation_successful (empty));
+ hb_map_destroy (empty);
+
+ hb_map_t *m = hb_map_create ();
+ g_assert (hb_map_allocation_successful (m));
+ g_assert (!hb_map_is_empty (m)); /* this as well */
+
+ hb_map_set (m, 213, 223);
+ hb_map_set (m, 643, 675);
+ g_assert_cmpint (hb_map_get_population (m), ==, 2);
+
+ g_assert_cmpint (hb_map_get (m, 213), ==, 223);
+ g_assert (hb_map_get (m, 123) == -1);
+ g_assert (hb_map_has (m, 213));
+
+ hb_map_del (m, 213);
+ g_assert (!hb_map_has (m, 213));
+
+ g_assert_cmpint (hb_map_get (m, 643), ==, 675);
+ hb_map_set (m, 237, 673);
+ g_assert (hb_map_has (m, 237));
+ hb_map_clear (m);
+ g_assert (!hb_map_has (m, 237));
+ g_assert (!hb_map_has (m, 643));
+ g_assert_cmpint (hb_map_get_population (m), ==, 0);
+
+ hb_map_destroy (m);
+}
+
+#define true 1
+#define false 0
+
+static void
+test_map_userdata ()
+{
+ hb_map_t *m = hb_map_create ();
+
+ hb_user_data_key_t key[2];
+ int *data = (int *) malloc (sizeof (int));
+ *data = 3123;
+ hb_map_set_user_data (m, &key[0], data, free, true);
+ g_assert_cmpint (*((int *) hb_map_get_user_data (m, &key[0])), ==, 3123);
+
+ int *data2 = (int *) malloc (sizeof (int));
+ *data2 = 6343;
+ hb_map_set_user_data (m, &key[0], data2, free, false);
+ g_assert_cmpint (*((int *) hb_map_get_user_data (m, &key[0])), ==, 3123);
+ hb_map_set_user_data (m, &key[0], data2, free, true);
+ g_assert_cmpint (*((int *) hb_map_get_user_data (m, &key[0])), ==, 6343);
+
+ hb_map_destroy (m);
+}
+
+static void
+test_map_refcount ()
+{
+ hb_map_t *m = hb_map_create ();
+ hb_map_set (m, 213, 223);
+ g_assert_cmpint (hb_map_get (m, 213), ==, 223);
+
+ hb_map_t *m2 = hb_map_reference (m);
+ hb_map_destroy (m);
+ g_assert (hb_map_has (m, 213));
+ g_assert (hb_map_has (m2, 213));
+
+ hb_map_destroy (m2);
+ g_assert (hb_map_has (m, 213)); /* shouldn't these return false? */
+ g_assert (hb_map_has (m2, 213));
+}
+
+int
+main (int argc, char **argv)
+{
+ hb_test_init (&argc, &argv);
+
+ hb_test_add (test_map_basic);
+ hb_test_add (test_map_userdata);
+
+ return hb_test_run();
+}
commit 8a5eba711069285e8d8b6d682eea0090256527bb
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date: Fri Oct 19 10:20:16 2018 +0330
[test] cosmetic, use g_assert_cmpint
diff --git a/test/api/test-ot-name.c b/test/api/test-ot-name.c
index 477e67f0..d5345bf1 100644
--- a/test/api/test-ot-name.c
+++ b/test/api/test-ot-name.c
@@ -53,11 +53,11 @@ test_ot_layout_feature_get_name_ids_and_characters ()
&num_named_parameters, &first_param_id))
g_error ("Failed to get name ids");
- g_assert (label_id == 256);
- g_assert (tooltip_id == 257);
- g_assert (sample_id == 258);
- g_assert (num_named_parameters == 2);
- g_assert (first_param_id == 259);
+ g_assert_cmpint (label_id, ==, 256);
+ g_assert_cmpint (tooltip_id, ==, 257);
+ g_assert_cmpint (sample_id, ==, 258);
+ g_assert_cmpint (num_named_parameters, ==, 2);
+ g_assert_cmpint (first_param_id, ==, 259);
hb_codepoint_t characters[100];
unsigned int char_count = 100;
@@ -66,10 +66,10 @@ test_ot_layout_feature_get_name_ids_and_characters ()
all_chars = hb_ot_layout_feature_get_characters (face, HB_OT_TAG_GSUB, feature_index,
0, &char_count, characters);
- g_assert (all_chars == 2);
- g_assert (char_count == 2);
- g_assert (characters[0] == 10);
- g_assert (characters[1] == 24030);
+ g_assert_cmpint (all_chars, ==, 2);
+ g_assert_cmpint (char_count, ==, 2);
+ g_assert_cmpint (characters[0], ==, 10);
+ g_assert_cmpint (characters[1], ==, 24030);
}
int
commit c6eb5e852c24e12fec3138cf9def5eb76acedfd6
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date: Fri Oct 19 10:14:25 2018 +0330
Don't report deprecated symbols as unused symbols
diff --git a/src/Makefile.am b/src/Makefile.am
index c74bab5d..b2b9ad54 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -283,6 +283,8 @@ harfbuzz-icu.def: $(HB_ICU_headers)
$(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^
harfbuzz-gobject.def: $(HB_GOBJECT_headers)
$(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^
+harfbuzz-deprecated.def: $(srcdir)/hb-deprecated.h
+ $(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^
GENERATORS = \
diff --git a/test/api/Makefile.am b/test/api/Makefile.am
index bae01d2c..2a50148a 100644
--- a/test/api/Makefile.am
+++ b/test/api/Makefile.am
@@ -166,11 +166,13 @@ symbols-tested.txt: $(TEST_PROGS)
$(AM_V_GEN)$(top_builddir)/libtool --mode=execute nm $^ \
| grep ' U hb_' | sed 's/.* U hb_/hb_/' \
| sort | uniq > $@.tmp && mv $@.tmp $@
+symbols-tested-or-deprecated.txt: symbols-tested.txt $(top_builddir)/src/harfbuzz-deprecated.def
+ $(AM_V_GEN)cat $^ | sort | uniq > $@.tmp; mv $@.tmp $@
symbols-exported.txt: $(top_builddir)/src/.libs/libharfbuzz.so
$(AM_V_GEN)$(top_builddir)/libtool --mode=execute nm $^ \
| grep ' T ' | sed 's/.* T //' | grep -v '^\(_init\|_fini\)$$' \
| sort | uniq > $@.tmp && mv $@.tmp $@
-symbols-untested.txt: symbols-tested.txt symbols-exported.txt
+symbols-untested.txt: symbols-tested-or-deprecated.txt symbols-exported.txt
$(AM_V_GEN)diff $^ > $@.tmp; mv $@.tmp $@
CLEANFILES += symbols-tested.txt symbols-exported.txt symbols-untested.txt
check-symbols: symbols-untested.txt
commit 34f357c78a7a530fdb3580ec9d3d865600c06128
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date: Fri Oct 19 10:13:53 2018 +0330
Add test for hb_set_del
diff --git a/test/api/test-set.c b/test/api/test-set.c
index 1382adaa..aa2b388e 100644
--- a/test/api/test-set.c
+++ b/test/api/test-set.c
@@ -118,6 +118,9 @@ test_set_basic (void)
g_assert (!hb_set_has (s, 801));
g_assert (!hb_set_has (s, 802));
+ hb_set_del (s, 800);
+ g_assert (!hb_set_has (s, 800));
+
hb_set_destroy (s);
}
commit 4594730f64e534e975065afce925b581fd9c6acd
Author: Bruce Mitchener <bruce.mitchener at gmail.com>
Date: Fri Oct 19 22:12:25 2018 +0700
Remove redundant return at end of void-returning function.
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
index 26a24105..14fab6b9 100644
--- a/src/hb-ot-layout-gsubgpos.hh
+++ b/src/hb-ot-layout-gsubgpos.hh
@@ -199,8 +199,6 @@ struct hb_collect_glyphs_context_t :
after = old_after;
recursed_lookups->add (lookup_index);
-
- return;
}
hb_face_t *face;
commit 093c7c4a54b37f5b12ad21e2d67f109597d068b1
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date: Fri Oct 19 18:46:41 2018 +0330
[ci] Run valgrind on test/api
run-shape-fuzzer-tests.py automatically runs valgrind if see available
but test/api runs it by request, we probably should normalize the approaches
later
diff --git a/.circleci/config.yml b/.circleci/config.yml
index b81564d2..d661a14e 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -100,7 +100,11 @@ jobs:
- run: pip install fonttools
- run: ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 --with-fontconfig
- run: make -j32
- - run: make check || .ci/fail.sh
+ # run-shape-fuzzer-tests.py automatically runs valgrind if see available
+ # but test/api runs it by request, we probably should normalize the approaches
+ - run: make check && make -Ctest/api check-valgrind || .ci/fail.sh
+ # informational for now
+ - run: make -Ctest/api check-symbols || true
clang-everything:
docker:
commit 8d1e479d1dcf7789be99a6cd0db0b883a90299dc
Author: Bruce Mitchener <bruce.mitchener at gmail.com>
Date: Thu Oct 18 22:18:42 2018 +0700
Use bool literals instead of 0/1.
diff --git a/src/hb-common.cc b/src/hb-common.cc
index 4940e7fb..ba48dd56 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -45,7 +45,7 @@ _hb_options_init (void)
{
hb_options_union_t u;
u.i = 0;
- u.opts.initialized = 1;
+ u.opts.initialized = true;
const char *c = getenv ("HB_OPTIONS");
if (c)
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index aa3921a3..9f7745db 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -643,7 +643,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
CFStringRef string_ref = nullptr;
CTLineRef line = nullptr;
- if (0)
+ if (false)
{
resize_and_retry:
DEBUG_MSG (CORETEXT, buffer, "Buffer resize");
@@ -1054,7 +1054,7 @@ resize_and_retry:
*
* https://crbug.com/419769
*/
- if (0)
+ if (false)
{
/* Make sure all runs had the expected direction. */
bool backward = HB_DIRECTION_IS_BACKWARD (buffer->props.direction);
diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index 4f81b327..dad6c4ea 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -1164,7 +1164,7 @@ struct MarkBasePosFormat1
))
break;
skippy_iter.reject ();
- } while (1);
+ } while (true);
/* Checking that matched glyph is actually a base glyph by GDEF is too strong; disabled */
//if (!_hb_glyph_info_is_base_glyph (&buffer->info[skippy_iter.idx])) { return_trace (false); }
diff --git a/src/hb-ot-tag.cc b/src/hb-ot-tag.cc
index 3d4e8b06..4dba9c31 100644
--- a/src/hb-ot-tag.cc
+++ b/src/hb-ot-tag.cc
@@ -201,7 +201,7 @@ subtag_matches (const char *lang_str,
if (!ISALNUM (s[strlen (subtag)]))
return true;
lang_str = s + strlen (subtag);
- } while (1);
+ } while (true);
}
static hb_bool_t
diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index b0cf1e92..b2289f86 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -64,7 +64,7 @@ hb_shape_plan_plan (hb_shape_plan_t *shape_plan,
if (likely (!shaper_list)) {
for (unsigned int i = 0; i < HB_SHAPERS_COUNT; i++)
- if (0)
+ if (false)
;
#define HB_SHAPER_IMPLEMENT(shaper) \
else if (shapers[i].func == _hb_##shaper##_shape) \
@@ -73,7 +73,7 @@ hb_shape_plan_plan (hb_shape_plan_t *shape_plan,
#undef HB_SHAPER_IMPLEMENT
} else {
for (; *shaper_list; shaper_list++)
- if (0)
+ if (false)
;
#define HB_SHAPER_IMPLEMENT(shaper) \
else if (0 == strcmp (*shaper_list, #shaper)) \
@@ -346,7 +346,7 @@ hb_shape_plan_execute (hb_shape_plan_t *shape_plan,
_hb_##shaper##_shape (shape_plan, font, buffer, features, num_features); \
} HB_STMT_END
- if (0)
+ if (false)
;
#define HB_SHAPER_IMPLEMENT(shaper) \
else if (shape_plan->shaper_func == _hb_##shaper##_shape) \
@@ -501,7 +501,7 @@ hb_shape_plan_create_cached2 (hb_face_t *face,
/* Choose shaper. Adapted from hb_shape_plan_plan().
* Must choose shaper exactly the same way as that function. */
for (const char * const *shaper_item = shaper_list; *shaper_item; shaper_item++)
- if (0)
+ if (false)
;
#define HB_SHAPER_IMPLEMENT(shaper) \
else if (0 == strcmp (*shaper_item, #shaper) && \
commit 257d0e5aa36fd5b3e54e04918ce12bb7d7e0d177
Author: Bruce Mitchener <bruce.mitchener at gmail.com>
Date: Fri Oct 19 22:49:21 2018 +0700
Fix typos.
diff --git a/BUILD.md b/BUILD.md
index 8a6b5695..4c1c3064 100644
--- a/BUILD.md
+++ b/BUILD.md
@@ -26,7 +26,7 @@ as with any other standard package. That should leave you with a shared
library in `src/`, and a few utility programs including `hb-view` and `hb-shape`
under `util/`.
-If you are bootstraping from git, you need a few more tools before you can
+If you are bootstrapping from git, you need a few more tools before you can
run `autogen.sh` for the first time. Namely, `pkg-config` and `ragel`.
Again, on Ubuntu / Debian:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 760883fd..4eb23af4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -107,10 +107,10 @@ include (CheckFunctionExists)
include (CheckIncludeFile)
macro (check_funcs) # Similar to AC_CHECK_FUNCS of autotools
foreach (func_name ${ARGN})
- string(TOUPPER ${func_name} definiton_to_add)
- check_function_exists(${func_name} HAVE_${definiton_to_add})
- if (${HAVE_${definiton_to_add}})
- add_definitions(-DHAVE_${definiton_to_add})
+ string(TOUPPER ${func_name} definition_to_add)
+ check_function_exists(${func_name} HAVE_${definition_to_add})
+ if (${HAVE_${definition_to_add}})
+ add_definitions(-DHAVE_${definition_to_add})
endif ()
endforeach ()
endmacro ()
diff --git a/README.python.md b/README.python.md
index 4c0ba9b2..7cf091a0 100644
--- a/README.python.md
+++ b/README.python.md
@@ -23,7 +23,7 @@ Then make sure you also have GI_TYPELIB_PATH pointing to the resulting
$prefix/lib/girepository-* directory.
Make sure you have pygobject installed. Then check that the following
-import works in your Python interpretter:
+import works in your Python interpreter:
```python
from gi.repository import HarfBuzz
diff --git a/README.wine.md b/README.wine.md
index 851d2bf3..799eb631 100644
--- a/README.wine.md
+++ b/README.wine.md
@@ -1,6 +1,6 @@
For the development of HarfBuzz, the Microsoft shaping technology, Uniscribe,
as a widely used and tested shaper is used as more-or-less OpenType reference
-implemenetation and that specially is important where OpenType specification
+implementation and that specially is important where OpenType specification
is or wasn't that clear. For having access to Uniscribe on Linux/macOS these
steps are recommended:
@@ -27,8 +27,8 @@ steps are recommended:
Now you can use hb-shape using `wine winbuild/util/hb-shape.exe` but if you like to
to use the original Uniscribe,
-8. Bring a 32bit version of `usp10.dll` for youself from `C:\Windows\SysWOW64\usp10.dll` of your
- Windows installation (asuming you have a 64-bit installation, otherwise `C:\Windows\System32\usp10.dll`)
+8. Bring a 32bit version of `usp10.dll` for yourself from `C:\Windows\SysWOW64\usp10.dll` of your
+ Windows installation (assuming you have a 64-bit installation, otherwise `C:\Windows\System32\usp10.dll`)
that it is not a DirectWrite proxy ([for more info](https://en.wikipedia.org/wiki/Uniscribe)).
Rule of thumb, your `usp10.dll` should have a size more than 500kb, otherwise
it is designed to work with DirectWrite which Wine can't work with its original one.
diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index d836a94d..717abea9 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -204,7 +204,7 @@ struct hb_dispatch_context_t
* The same argument can be made re GSUB/GPOS/GDEF, but there, the table
* structure is so complicated that by checking all offsets at sanitize() time,
* we make the code much simpler in other methods, as offsets and referenced
- * objectes do not need to be validated at each use site.
+ * objects do not need to be validated at each use site.
*/
/* This limits sanitizing time on really broken fonts. */
diff --git a/src/hb-null.hh b/src/hb-null.hh
index bf01b3af..87662265 100644
--- a/src/hb-null.hh
+++ b/src/hb-null.hh
@@ -49,7 +49,7 @@ static inline Type const & Null (void) {
}
#define Null(Type) Null<Type>()
-/* Specializaitons for arbitrary-content Null objects expressed in bytes. */
+/* Specializations for arbitrary-content Null objects expressed in bytes. */
#define DECLARE_NULL_NAMESPACE_BYTES(Namespace, Type) \
} /* Close namespace. */ \
extern HB_INTERNAL const unsigned char _hb_Null_##Namespace##_##Type[Namespace::Type::min_size]; \
@@ -62,7 +62,7 @@ static inline Type const & Null (void) {
#define DEFINE_NULL_NAMESPACE_BYTES(Namespace, Type) \
const unsigned char _hb_Null_##Namespace##_##Type[Namespace::Type::min_size]
-/* Specializaitons for arbitrary-content Null objects expressed as struct initializer. */
+/* Specializations for arbitrary-content Null objects expressed as struct initializer. */
#define DECLARE_NULL_INSTANCE(Type) \
extern HB_INTERNAL const Type _hb_Null_##Type; \
template <> \
diff --git a/src/hb-open-file.hh b/src/hb-open-file.hh
index 8772c79f..817791ab 100644
--- a/src/hb-open-file.hh
+++ b/src/hb-open-file.hh
@@ -160,7 +160,7 @@ typedef struct OffsetTable
memcpy (start, hb_blob_get_data (blob, nullptr), rec.length);
- /* 4-byte allignment. */
+ /* 4-byte alignment. */
c->align (4);
const char *end = (const char *) c->head;
diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh
index 0c60a130..c59910de 100644
--- a/src/hb-ot-layout-common.hh
+++ b/src/hb-ot-layout-common.hh
@@ -718,7 +718,7 @@ struct Lookup
return_trace (true);
}
- /* Older compileres need this to NOT be locally defined in a function. */
+ /* Older compilers need this to NOT be locally defined in a function. */
template <typename TSubTable>
struct SubTableSubsetWrapper
{
diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh
index cad99a3d..75709086 100644
--- a/src/hb-ot-layout-gdef-table.hh
+++ b/src/hb-ot-layout-gdef-table.hh
@@ -388,7 +388,7 @@ struct GDEF
{ return version.to_int () >= 0x00010003u ? this+varStore : Null(VariationStore); }
/* glyph_props is a 16-bit integer where the lower 8-bit have bits representing
- * glyph class and other bits, and high 8-bit gthe mark attachment type (if any).
+ * glyph class and other bits, and high 8-bit the mark attachment type (if any).
* Not to be confused with lookup_props which is very similar. */
inline unsigned int get_glyph_props (hb_codepoint_t glyph) const
{
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index b664f15a..2ce52a1b 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -103,7 +103,7 @@ struct SingleSubstFormat1
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
if (unlikely (!coverage.serialize (c, this).serialize (c, glyphs, num_glyphs))) return_trace (false);
- deltaGlyphID.set (delta); /* TODO(serilaize) overflow? */
+ deltaGlyphID.set (delta); /* TODO(serialize) overflow? */
return_trace (true);
}
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
index 695a5df9..26a24105 100644
--- a/src/hb-ot-layout-gsubgpos.hh
+++ b/src/hb-ot-layout-gsubgpos.hh
@@ -582,7 +582,7 @@ struct hb_ot_apply_context_t :
add_in |= HB_OT_LAYOUT_GLYPH_PROPS_LIGATED;
/* In the only place that the MULTIPLIED bit is used, Uniscribe
* seems to only care about the "last" transformation between
- * Ligature and Multiple substitions. Ie. if you ligate, expand,
+ * Ligature and Multiple substitutions. Ie. if you ligate, expand,
* and ligate again, it forgives the multiplication and acts as
* if only ligation happened. As such, clear MULTIPLIED bit.
*/
commit b7cef8cb1dfaf1f0f2c0d79b96b171049b69466a
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date: Fri Oct 19 09:24:21 2018 +0330
Enable valgrind and dedicate a bot to it
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 1cf4bc88..b81564d2 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -90,6 +90,18 @@ jobs:
- run: make -j32
- run: LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || .ci/fail.sh
+ gcc-valgrind:
+ docker:
+ - image: ubuntu:18.10
+ steps:
+ - checkout
+ - run: apt update || true
+ - run: apt install -y gcc binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libfontconfig1-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip valgrind
+ - run: pip install fonttools
+ - run: ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 --with-fontconfig
+ - run: make -j32
+ - run: make check || .ci/fail.sh
+
clang-everything:
docker:
- image: ubuntu:18.10
@@ -293,6 +305,7 @@ workflows:
# autotools based builds
- alpine-O3-NOMMAP
- archlinux-debug-O0-py3
+ - gcc-valgrind
- clang-O3-O0
- clang-everything
- clang-asan
diff --git a/test/fuzzing/run-shape-fuzzer-tests.py b/test/fuzzing/run-shape-fuzzer-tests.py
index 8fadd167..dcdab671 100755
--- a/test/fuzzing/run-shape-fuzzer-tests.py
+++ b/test/fuzzing/run-shape-fuzzer-tests.py
@@ -5,6 +5,24 @@ from __future__ import print_function, division, absolute_import
import sys, os, subprocess, tempfile, threading
+def which(program):
+ # https://stackoverflow.com/a/377028
+ def is_exe(fpath):
+ return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
+
+ fpath, _ = os.path.split(program)
+ if fpath:
+ if is_exe(program):
+ return program
+ else:
+ for path in os.environ["PATH"].split(os.pathsep):
+ exe_file = os.path.join(path, program)
+ if is_exe(exe_file):
+ return exe_file
+
+ return None
+
+
def cmd(command):
# https://stackoverflow.com/a/4408409
# https://stackoverflow.com/a/10012262
@@ -49,6 +67,8 @@ please provide it as the first argument to the tool""")
print ('hb_shape_fuzzer:', hb_shape_fuzzer)
fails = 0
+valgrind = which ('valgrind')
+
parent_path = os.path.join (srcdir, "fonts")
for file in os.listdir (parent_path):
path = os.path.join(parent_path, file)
@@ -56,8 +76,19 @@ for file in os.listdir (parent_path):
text, returncode = cmd ([hb_shape_fuzzer, path])
print (text)
+ failed = False
if returncode != 0 or 'error' in text:
print ('failure on %s' % file)
+ failed = True
+
+ if valgrind:
+ text, returncode = cmd ([valgrind, '--error-exitcode=1', hb_shape_fuzzer, path])
+ if returncode:
+ print (text)
+ print ('failure on %s' % file)
+ failed = True
+
+ if failed:
fails = fails + 1
if fails:
commit bccd09d6c7baa99fdaccb8c5b3ff7e1834edd3bf
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date: Fri Oct 19 09:06:42 2018 +0330
Minor, tweak spaces on hb-shape-fuzzer.cc
diff --git a/test/fuzzing/hb-shape-fuzzer.cc b/test/fuzzing/hb-shape-fuzzer.cc
index 79f32229..b5a6c12e 100644
--- a/test/fuzzing/hb-shape-fuzzer.cc
+++ b/test/fuzzing/hb-shape-fuzzer.cc
@@ -5,29 +5,29 @@
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);
- hb_font_t *font = hb_font_create(face);
- hb_ot_font_set_funcs(font);
- hb_font_set_scale(font, 12, 12);
+ 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_font_t *font = hb_font_create (face);
+ hb_ot_font_set_funcs (font);
+ hb_font_set_scale (font, 12, 12);
{
const char text[] = "ABCDEXYZ123 at _%&)*$!";
- hb_buffer_t *buffer = hb_buffer_create();
- hb_buffer_add_utf8(buffer, text, -1, 0, -1);
- hb_buffer_guess_segment_properties(buffer);
- hb_shape(font, buffer, NULL, 0);
- hb_buffer_destroy(buffer);
+ hb_buffer_t *buffer = hb_buffer_create ();
+ hb_buffer_add_utf8 (buffer, text, -1, 0, -1);
+ hb_buffer_guess_segment_properties (buffer);
+ hb_shape (font, buffer, NULL, 0);
+ hb_buffer_destroy (buffer);
}
uint32_t text32[16];
- if (size > sizeof(text32)) {
- memcpy(text32, data + size - sizeof(text32), sizeof(text32));
- hb_buffer_t *buffer = hb_buffer_create();
- hb_buffer_add_utf32(buffer, text32, sizeof(text32)/sizeof(text32[0]), 0, -1);
- hb_buffer_guess_segment_properties(buffer);
- hb_shape(font, buffer, NULL, 0);
+ if (size > sizeof (text32)) {
+ memcpy(text32, data + size - sizeof (text32), sizeof (text32));
+ hb_buffer_t *buffer = hb_buffer_create ();
+ hb_buffer_add_utf32 (buffer, text32, sizeof (text32) / sizeof (text32[0]), 0, -1);
+ hb_buffer_guess_segment_properties (buffer);
+ hb_shape (font, buffer, NULL, 0);
unsigned int len = hb_buffer_get_length (buffer);
hb_glyph_info_t *infos = hb_buffer_get_glyph_infos (buffer, NULL);
@@ -41,12 +41,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
hb_font_get_glyph_extents (font, info.codepoint, &extents);
}
- hb_buffer_destroy(buffer);
+ hb_buffer_destroy (buffer);
}
- hb_font_destroy(font);
- hb_face_destroy(face);
- hb_blob_destroy(blob);
+ hb_font_destroy (font);
+ hb_face_destroy (face);
+ hb_blob_destroy (blob);
return 0;
}
commit fbf665b307c8cc9f16f5897671bfdd8719a195b5
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date: Fri Oct 19 08:09:53 2018 +0330
[fuzz] Add more found cases (#1275)
diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-hb-shape-fuzzer-5728971283496960 b/test/fuzzing/fonts/clusterfuzz-testcase-hb-shape-fuzzer-5728971283496960
new file mode 100644
index 00000000..25d7bf1d
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-hb-shape-fuzzer-5728971283496960 differ
diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5713868010553344 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5713868010553344
new file mode 100644
index 00000000..ee0a721b
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5713868010553344 differ
diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6278851874258944 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6278851874258944
new file mode 100644
index 00000000..775c9188
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6278851874258944 differ
diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5649959857160192 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5649959857160192
new file mode 100644
index 00000000..72e702ec
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5649959857160192 differ
diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5664873493561344 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5664873493561344
new file mode 100644
index 00000000..dfc36d89
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5664873493561344 differ
diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5762953198960640 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5762953198960640
new file mode 100644
index 00000000..9d64eafd
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5762953198960640 differ
diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5764636557705216 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5764636557705216
new file mode 100644
index 00000000..b07416b0
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5764636557705216 differ
diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5690658895953920 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5690658895953920
new file mode 100644
index 00000000..abafa4bc
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5690658895953920 differ
diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5695279609675776 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5695279609675776
new file mode 100644
index 00000000..f0162623
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5695279609675776 differ
diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5718215406125056 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5718215406125056
new file mode 100644
index 00000000..a6d87daf
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5718215406125056 differ
diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5743250149736448 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5743250149736448
new file mode 100644
index 00000000..b17c9499
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5743250149736448 differ
diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5765071062958080 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5765071062958080
new file mode 100644
index 00000000..1f9be049
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5765071062958080 differ
diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-get-codepoints-fuzzer-5930139383758848 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-get-codepoints-fuzzer-5930139383758848
new file mode 100644
index 00000000..940fbd50
Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-get-codepoints-fuzzer-5930139383758848 differ
More information about the HarfBuzz
mailing list