[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
diff --git a/ChangeLog b/ChangeLog
index 65c492e..c741371 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2017-03-30 Werner Lemberg <wl@gnu.org>
+ [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 <wl@gnu.org>
+
[truetype] Allow linear scaling for unhinted rendering (#50470).
* src/truetype/ttdriver.c (tt_size_request): Revert change from
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index a87913d..6d4529b 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
{