Fix more hangs in case of buffer allocation errors
authorBehdad Esfahbod <behdad@behdad.org>
Tue, 2 Feb 2016 08:39:19 +0000 (16:39 +0800)
committerBehdad Esfahbod <behdad@behdad.org>
Tue, 2 Feb 2016 08:39:19 +0000 (16:39 +0800)
Hopefully
fixes https://github.com/behdad/harfbuzz/issues/214

src/hb-ot-shape-complex-indic.cc
src/hb-ot-shape-complex-myanmar.cc
src/hb-ot-shape-complex-use.cc

index 880aa91..21256de 100644 (file)
@@ -1246,7 +1246,7 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
       /* TODO Set glyph_props? */
 
       /* Insert dottedcircle after possible Repha. */
-      while (buffer->idx < buffer->len &&
+      while (buffer->idx < buffer->len && !buffer->in_error &&
             last_syllable == buffer->cur().syllable() &&
             buffer->cur().indic_category() == OT_Repha)
         buffer->next_glyph ();
index 4d34468..7b04344 100644 (file)
@@ -451,7 +451,7 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
 
   buffer->idx = 0;
   unsigned int last_syllable = 0;
-  while (buffer->idx < buffer->len)
+  while (buffer->idx < buffer->len && !buffer->in_error)
   {
     unsigned int syllable = buffer->cur().syllable();
     syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F);
index 0f66783..d67cde2 100644 (file)
@@ -522,7 +522,7 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
       /* TODO Set glyph_props? */
 
       /* Insert dottedcircle after possible Repha. */
-      while (buffer->idx < buffer->len &&
+      while (buffer->idx < buffer->len && !buffer->in_error &&
             last_syllable == buffer->cur().syllable() &&
             buffer->cur().use_category() == USE_R)
         buffer->next_glyph ();