diff --git a/ChangeLog b/ChangeLog index 12fab2b79..bbc0422c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-12-11 Werner Lemberg + + * src/base/ftobjs.c (FT_Get_Glyph_Name): Fix off-by-one check. + + Problem reported by Dennis Felsing . + 2014-12-11 Werner Lemberg * src/type42/t42parse.c (t42_parse_sfnts): Check `string_size'. diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index c6e4b1974..ee15a016c 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -3648,8 +3648,10 @@ /* clean up buffer */ ((FT_Byte*)buffer)[0] = '\0'; - if ( (FT_Long)glyph_index > face->num_glyphs || - !FT_HAS_GLYPH_NAMES( face ) ) + if ( (FT_Long)glyph_index >= face->num_glyphs ) + return FT_THROW( Invalid_Glyph_Index ); + + if ( !FT_HAS_GLYPH_NAMES( face ) ) return FT_THROW( Invalid_Argument ); FT_FACE_LOOKUP_SERVICE( face, service, GLYPH_DICT );