[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
pull/2899/head
Behdad Esfahbod 4 years ago
parent 99767f9386
commit a5b8e7db4d
  1. 9
      src/hb-ot-shape-complex-hangul.cc

@ -274,8 +274,6 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan HB_UNUSED,
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 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan HB_UNUSED,
}
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 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan HB_UNUSED,
{
buffer->replace_glyphs (2, 1, &new_s);
if (unlikely (!buffer->successful))
return;
break;
end = start + 1;
continue;
}
@ -359,9 +359,8 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan HB_UNUSED,
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.

Loading…
Cancel
Save