Commit 69446ddccec76a1660284ea37e6a89556e06be82

Behdad Esfahbod 2016-07-16T10:52:38

[truetype] Make all glyphs in `Zycon' GX font work. * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary tests.

diff --git a/ChangeLog b/ChangeLog
index 5b9df4a..eb2cf79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-07-16  Behdad Esfahbod  <behdad@behdad.org>
+
+	[truetype] Make all glyphs in `Zycon' GX font work.
+
+	* src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary
+	tests.
+
 2016-07-16  Werner Lemberg  <wl@gnu.org>
 
 	[truetype] Fix GX delta tracing.
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 1ddaa0d..7c85d62 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -174,14 +174,13 @@
         first      += FT_GET_USHORT();
         points[i++] = first;
 
-        if ( runcnt < 1 || i + runcnt > n )
-          goto Exit;
-
         /* first point not included in run count */
         for ( j = 0; j < runcnt; j++ )
         {
           first      += FT_GET_USHORT();
           points[i++] = first;
+          if ( i == n )
+            break;
         }
       }
       else
@@ -189,18 +188,16 @@
         first      += FT_GET_BYTE();
         points[i++] = first;
 
-        if ( runcnt < 1 || i + runcnt > n )
-          goto Exit;
-
         for ( j = 0; j < runcnt; j++ )
         {
           first      += FT_GET_BYTE();
           points[i++] = first;
+          if ( i == n )
+            break;
         }
       }
     }
 
-  Exit:
     return points;
   }