shithub: freetype+ttf2subf

Download patch

ref: 59c9fea654a11b58d0542d0278c0e7c43f9729f6
parent: 7a1e2c12bf542faf0e6ddfb9bbdec82f6366ac3b
author: David Turner <[email protected]>
date: Fri Dec 14 10:14:44 EST 2001

* src/truetype/ttgload.c (load_truetype_glyph): fixing crash when dealing
    with invalid fonts (i.e. glyph size < 10 bytes)..

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-12-14  Scott Long  <[email protected]>
+
+    * src/truetype/ttgload.c (load_truetype_glyph): fixing crash when dealing
+    with invalid fonts (i.e. glyph size < 10 bytes)..
+
 2001-12-14  Sam Latinga <[email protected]>
 
     * builds/mac/freetype.mac: a new Makefile to build with MPW on MacOS
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -723,6 +723,16 @@
     if ( index < (FT_UInt)face->num_locations - 1 )
        count = face->glyph_locations[index + 1] - offset;
 
+    /* temporary hack */
+#if 1
+    if ( count < 10 )
+    {
+      /* This glyph is corrupted -- it does not have a complete header */
+      error = TT_Err_Invalid_Outline;
+      goto Fail;
+    }
+#endif
+
     if ( count == 0 )
     {
       /* as described by Frederic Loyer, these are spaces, and */