[buffer] Fix output_glyph at end of buffer

Part of https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10955
This commit is contained in:
Behdad Esfahbod 2018-10-14 19:36:46 -07:00
parent 7efa38257b
commit 60c1397673
1 changed files with 4 additions and 1 deletions

View File

@ -229,7 +229,10 @@ struct hb_buffer_t
{
if (unlikely (!make_room_for (0, 1))) return Crap(hb_glyph_info_t);
out_info[out_len] = info[idx];
if (unlikely (idx == len && !out_len))
return Crap(hb_glyph_info_t);
out_info[out_len] = idx < len ? info[idx] : out_info[out_len - 1];
out_info[out_len].codepoint = glyph_index;
out_len++;