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

Behdad Esfahbod behdad at kemper.freedesktop.org
Sat Dec 2 23:16:16 UTC 2017


 src/hb-set-private.hh |    2 +-
 test/api/test-set.c   |   24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

New commits:
commit 20b4672754baf9751642bb37344a6ff4e224dc37
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Dec 2 15:14:26 2017 -0800

    [set] Fix recent changes
    
    Ouch!
    
    Add tests.

diff --git a/test/api/test-set.c b/test/api/test-set.c
index 0d0b6a76..bbea2cf5 100644
--- a/test/api/test-set.c
+++ b/test/api/test-set.c
@@ -86,6 +86,30 @@ test_set_basic (void)
   test_not_empty (s);
   g_assert (!hb_set_has (s, 13));
 
+  hb_set_add_range (s, 200, 800);
+  test_not_empty (s);
+  g_assert (!hb_set_has (s, 100));
+  g_assert (!hb_set_has (s, 199));
+  g_assert (hb_set_has (s, 200));
+  g_assert (hb_set_has (s, 201));
+  g_assert (hb_set_has (s, 243));
+  g_assert (hb_set_has (s, 254));
+  g_assert (hb_set_has (s, 255));
+  g_assert (hb_set_has (s, 256));
+  g_assert (hb_set_has (s, 257));
+  g_assert (hb_set_has (s, 511));
+  g_assert (hb_set_has (s, 512));
+  g_assert (hb_set_has (s, 600));
+  g_assert (hb_set_has (s, 767));
+  g_assert (hb_set_has (s, 768));
+  g_assert (hb_set_has (s, 769));
+  g_assert (hb_set_has (s, 782));
+  g_assert (hb_set_has (s, 798));
+  g_assert (hb_set_has (s, 799));
+  g_assert (hb_set_has (s, 800));
+  g_assert (!hb_set_has (s, 801));
+  g_assert (!hb_set_has (s, 802));
+
   hb_set_destroy (s);
 }
 
commit 0744149cdabd85d632822ff810d3994787bca4b7
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Dec 2 15:06:15 2017 -0800

    [set] Protect against bad input in hb_set_add_range()

diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index a47b17a3..2b459756 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -217,7 +217,7 @@ struct hb_set_t
   }
   inline void add_range (hb_codepoint_t a, hb_codepoint_t b)
   {
-    if (unlikely (in_error)) return;
+    if (unlikely (in_error || a > b)) return;
     unsigned int ma = get_major (a);
     unsigned int mb = get_major (b);
     if (ma == mb)


More information about the HarfBuzz mailing list