shithub: freetype+ttf2subf

Download patch

ref: da38be831d2c8ea5443c73d01ecfbc750bba7045
parent: bcc74f4dafee25ea89f1d3144646cba7e30f9908
author: Werner Lemberg <[email protected]>
date: Thu Mar 30 09:24:03 EDT 2017

[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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2017-03-30  Werner Lemberg  <[email protected]>
 
+	[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  <[email protected]>
+
 	[truetype] Allow linear scaling for unhinted rendering (#50470).
 
 	* src/truetype/ttdriver.c (tt_size_request): Revert change from
--- 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
     {