From 7fed7d80f72b35900b41878ae59e38fd1cb49dc8 Mon Sep 17 00:00:00 2001 From: Michiharu Ariza Date: Wed, 7 Nov 2018 09:09:13 -0800 Subject: [PATCH] fixed off-by-one error in CFF1 Encoding lookup --- src/hb-ot-cff1-table.hh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hb-ot-cff1-table.hh b/src/hb-ot-cff1-table.hh index bc67e49b5..820404ed6 100644 --- a/src/hb-ot-cff1-table.hh +++ b/src/hb-ot-cff1-table.hh @@ -64,6 +64,8 @@ struct Encoding0 { inline hb_codepoint_t get_code (hb_codepoint_t glyph) const { + assert (glyph > 0); + glyph--; if (glyph < nCodes) { return (hb_codepoint_t)codes[glyph]; @@ -106,6 +108,8 @@ struct Encoding1 { inline hb_codepoint_t get_code (hb_codepoint_t glyph) const { + assert (glyph > 0); + glyph--; for (unsigned int i = 0; i < nRanges; i++) { if (glyph <= ranges[i].nLeft)