From b59e25f25ef20dddc7e4dff0432c63d1afe287ae Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 7 Jun 2022 09:27:09 -0600 Subject: [PATCH] [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 --- src/hb-ot-cff1-table.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hb-ot-cff1-table.hh b/src/hb-ot-cff1-table.hh index ce97182e1..4aa337f78 100644 --- a/src/hb-ot-cff1-table.hh +++ b/src/hb-ot-cff1-table.hh @@ -406,6 +406,8 @@ struct Charset1_2 { void collect_glyph_to_sid_map (hb_map_t *mapping, unsigned int num_glyphs) const { hb_codepoint_t gid = 1; + if (gid >= num_glyphs) + return; for (unsigned i = 0;; i++) { hb_codepoint_t sid = ranges[i].first;