[hangul] Improve error handling I did a review; changed some "return"s to "break"s, which should be identical. Removed one check just before "continue" because not necessary. The added error check is the actual fix. Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31755
diff --git a/src/hb-ot-shape-complex-hangul.cc b/src/hb-ot-shape-complex-hangul.cc index 9878d1f..533e928 100644 --- a/src/hb-ot-shape-complex-hangul.cc +++ b/src/hb-ot-shape-complex-hangul.cc
@@ -274,8 +274,6 @@ if (font->has_glyph (s)) { buffer->replace_glyphs (t ? 3 : 2, 1, &s); - if (unlikely (!buffer->successful)) - return; end = start + 1; continue; } @@ -298,6 +296,8 @@ } else end = start + 2; + if (unlikely (!buffer->successful)) + break; if (buffer->cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES) buffer->merge_out_clusters (start, end); continue; @@ -325,7 +325,7 @@ { buffer->replace_glyphs (2, 1, &new_s); if (unlikely (!buffer->successful)) - return; + break; end = start + 1; continue; } @@ -359,9 +359,8 @@ buffer->next_glyph (); s_len++; } - if (unlikely (!buffer->successful)) - return; + break; /* We decomposed S: apply jamo features to the individual glyphs * that are now in buffer->out_info.