[cff] Try fixing Heap-buffer-overflow in CFF::Charset::collect_glyph_to_sid_map

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47790
This commit is contained in:
Behdad Esfahbod 2022-06-07 09:27:09 -06:00
parent 356c1f8336
commit b59e25f25e
1 changed files with 2 additions and 0 deletions

View File

@ -406,6 +406,8 @@ struct Charset1_2 {
void collect_glyph_to_sid_map (hb_map_t *mapping, unsigned int num_glyphs) const void collect_glyph_to_sid_map (hb_map_t *mapping, unsigned int num_glyphs) const
{ {
hb_codepoint_t gid = 1; hb_codepoint_t gid = 1;
if (gid >= num_glyphs)
return;
for (unsigned i = 0;; i++) for (unsigned i = 0;; i++)
{ {
hb_codepoint_t sid = ranges[i].first; hb_codepoint_t sid = ranges[i].first;