diff --git a/ChangeLog b/ChangeLog index 65c492e6d..c7413718e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-03-30 Werner Lemberg + + [truetype] Fix HVAR and VVAR handling (#50678). + + * src/truetype/ttgxvar.c (tt_hvadvance_adjust): Handle + glyph indices larger than `mapCount' as described in the + specification. + 2017-03-30 Werner Lemberg [truetype] Allow linear scaling for unhinted rendering (#50470). diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index a87913d8c..6d4529ba5 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -1007,16 +1007,15 @@ if ( table->widthMap.innerIndex ) { - if ( gindex >= table->widthMap.mapCount ) - { - FT_TRACE2(( "gindex %d out of range\n", gindex )); - error = FT_THROW( Invalid_Argument ); - goto Exit; - } + FT_UInt idx = gindex; + + + if ( idx >= table->widthMap.mapCount ) + idx = table->widthMap.mapCount - 1; /* trust that HVAR parser has checked indices */ - outerIndex = table->widthMap.outerIndex[gindex]; - innerIndex = table->widthMap.innerIndex[gindex]; + outerIndex = table->widthMap.outerIndex[idx]; + innerIndex = table->widthMap.innerIndex[idx]; } else {