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

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Nov 19 12:17:36 PST 2015


 src/hb-buffer-private.hh |    5 ++---
 src/hb-buffer.cc         |   31 ++++++++-----------------------
 test/fuzzing/Makefile.am |    4 ++++
 3 files changed, 14 insertions(+), 26 deletions(-)

New commits:
commit 7d75eee799bbb5ee7eef2651cf7b7d3aee6f09b0
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Nov 19 12:03:04 2015 -0800

    [fuzzing] Run fuzzing tests using hb-fuzzer as well

diff --git a/test/fuzzing/Makefile.am b/test/fuzzing/Makefile.am
index 8359d03..d66d5d9 100644
--- a/test/fuzzing/Makefile.am
+++ b/test/fuzzing/Makefile.am
@@ -41,4 +41,8 @@ hb_fuzzer_CPPFLAGS = \
 	-DMAIN \
 	$(NULL)
 
+check:
+	cat $(top_srcdir)/test/shaping/tests/fuzzed.tests | \
+	cut -d: -f1 | xargs ./hb-fuzzer
+
 -include $(top_srcdir)/git.mk
commit 13188cba7f0eaacd587beeb1c2258526ae24c438
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Nov 19 11:59:03 2015 -0800

    Revert "Fix hang in OOM situations"
    
    This reverts commit f0599db761d7fc2d585d86e757a797f75ebc7499.
    
    Commit abadc1717d997b69f987fdf1be9e12156d2d13d6 provides a better
    fix for this.

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 4901802..111078c 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -174,11 +174,7 @@ struct hb_buffer_t {
     if (have_output)
     {
       if (unlikely (out_info != info || out_len != idx)) {
-	if (unlikely (!make_room_for (1, 1)))
-	{
-	  idx++; // So we don't hang indefinitely...
-	  return;
-	}
+	if (unlikely (!make_room_for (1, 1))) return;
 	out_info[out_len] = info[idx];
       }
       out_len++;
commit 18e1c6b6ef7c85a1b02e3dae86280d8ed6b65118
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Nov 19 11:50:58 2015 -0800

    Revert "Make sure we make progress in OOM situations"
    
    This reverts commit 68b507a3c3c62c28c38e13fee733702bb703b6ca.
    
    Commit abadc1717d997b69f987fdf1be9e12156d2d13d6 provides a better
    fix for this.

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index ceccecd..4901802 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -175,12 +175,15 @@ struct hb_buffer_t {
     {
       if (unlikely (out_info != info || out_len != idx)) {
 	if (unlikely (!make_room_for (1, 1)))
-	  goto done;
+	{
+	  idx++; // So we don't hang indefinitely...
+	  return;
+	}
 	out_info[out_len] = info[idx];
       }
       out_len++;
     }
-  done:
+
     idx++;
   }
 
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 7e7dcea..5c71734 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -324,9 +324,7 @@ hb_buffer_t::replace_glyphs (unsigned int num_in,
 			     unsigned int num_out,
 			     const uint32_t *glyph_data)
 {
-  if (unlikely (!make_room_for (num_in, num_out)))
-    goto done;
-  {
+  if (unlikely (!make_room_for (num_in, num_out))) return;
 
   merge_clusters (idx, idx + num_in);
 
@@ -339,50 +337,39 @@ hb_buffer_t::replace_glyphs (unsigned int num_in,
     pinfo++;
   }
 
-  out_len += num_out;
-  }
-done:
   idx  += num_in;
+  out_len += num_out;
 }
 
 void
 hb_buffer_t::output_glyph (hb_codepoint_t glyph_index)
 {
-  if (unlikely (!make_room_for (0, 1)))
-    goto done;
+  if (unlikely (!make_room_for (0, 1))) return;
 
   out_info[out_len] = info[idx];
   out_info[out_len].codepoint = glyph_index;
 
   out_len++;
-done:
-  ;
 }
 
 void
 hb_buffer_t::output_info (const hb_glyph_info_t &glyph_info)
 {
-  if (unlikely (!make_room_for (0, 1)))
-    goto done;
+  if (unlikely (!make_room_for (0, 1))) return;
 
   out_info[out_len] = glyph_info;
 
   out_len++;
-done:
-  ;
 }
 
 void
 hb_buffer_t::copy_glyph (void)
 {
-  if (unlikely (!make_room_for (0, 1)))
-    goto done;
+  if (unlikely (!make_room_for (0, 1))) return;
 
   out_info[out_len] = info[idx];
 
   out_len++;
-done:
-  ;
 }
 
 bool
@@ -400,7 +387,7 @@ hb_buffer_t::move_to (unsigned int i)
   if (out_len < i)
   {
     unsigned int count = i - out_len;
-    if (unlikely (!make_room_for (count, count))) return false; // XXX verify bailout
+    if (unlikely (!make_room_for (count, count))) return false;
 
     memmove (out_info + out_len, info + idx, count * sizeof (out_info[0]));
     idx += count;
@@ -427,15 +414,13 @@ void
 hb_buffer_t::replace_glyph (hb_codepoint_t glyph_index)
 {
   if (unlikely (out_info != info || out_len != idx)) {
-    if (unlikely (!make_room_for (1, 1)))
-      goto out;
+    if (unlikely (!make_room_for (1, 1))) return;
     out_info[out_len] = info[idx];
   }
   out_info[out_len].codepoint = glyph_index;
 
-  out_len++;
-out:
   idx++;
+  out_len++;
 }
 
 


More information about the HarfBuzz mailing list