Try to better handle OOM situations Fixes assert fail in https://github.com/behdad/harfbuzz/issues/161 with libharfbuzz-fuzzing.
diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc index cc01fd3..dc2d7af 100644 --- a/src/hb-ot-shape-complex-use.cc +++ b/src/hb-ot-shape-complex-use.cc
@@ -490,11 +490,6 @@ if (likely (!has_broken_syllables)) return; - - hb_codepoint_t dottedcircle_glyph; - if (!font->get_glyph (0x25CCu, 0, &dottedcircle_glyph)) - return; - hb_glyph_info_t dottedcircle = {0}; if (!font->get_glyph (0x25CCu, 0, &dottedcircle.codepoint)) return; @@ -503,9 +498,8 @@ buffer->clear_output (); 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);