shithub: freetype+ttf2subf

Download patch

ref: 06842c7b49c21f13c0ab61201daab6ff5a358fcc
parent: bef8df0a3ab0ce7cc9f9c9d12f1f90183bf1e2fd
author: Werner Lemberg <[email protected]>
date: Sat Dec 13 02:42:51 EST 2014

* src/pcf/pcfread.c (pcf_read_TOC): Improve fix from 2014-12-08.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-12-13  Werner Lemberg  <[email protected]>
+
+	* src/pcf/pcfread.c (pcf_read_TOC): Improve fix from 2014-12-08.
+
 2014-12-11  Werner Lemberg  <[email protected]>
 
 	* builds/toplevel.mk (dist): Use older POSIX standard for `tar'.
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -192,14 +192,15 @@
       tables++;
     }
 
-    /* no check of `tables->size' for last table element ... */
+    /* only check `tables->offset' for last table element ... */
     if ( ( tables->offset > size ) )
     {
       error = FT_THROW( Invalid_Table );
       goto Exit;
     }
-    /* ... instead, we adjust `tables->size' to the real value */
-    tables->size = size - tables->offset;
+    /* ... and adjust `tables->size' to the real value if necessary */
+    if ( tables->size > size - tables->offset )
+      tables->size = size - tables->offset;
 
 #ifdef FT_DEBUG_LEVEL_TRACE