From 59fe379797adca37e29c002ffabc27f9c74f8746 Mon Sep 17 00:00:00 2001 From: blueshade7 Date: Sat, 16 Nov 2019 19:47:31 -0800 Subject: [PATCH] fixed hb-shape-fuzzer failures in get_sid --- src/hb-ot-cff1-table.hh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-cff1-table.hh b/src/hb-ot-cff1-table.hh index 70a4fffb7..965aa9fce 100644 --- a/src/hb-ot-cff1-table.hh +++ b/src/hb-ot-cff1-table.hh @@ -545,8 +545,9 @@ struct Charset } } - hb_codepoint_t get_sid (hb_codepoint_t glyph) const + hb_codepoint_t get_sid (hb_codepoint_t glyph, unsigned int num_glyphs) const { + if (unlikely (glyph >= num_glyphs)) return 0; switch (format) { case 0: return u.format0.get_sid (glyph); @@ -1216,7 +1217,7 @@ struct cff1 hb_codepoint_t glyph_to_sid (hb_codepoint_t glyph) const { if (charset != &Null(Charset)) - return charset->get_sid (glyph); + return charset->get_sid (glyph, num_glyphs); else { hb_codepoint_t sid = 0;