Commit 59c9fea654a11b58d0542d0278c0e7c43f9729f6

David Turner 2001-12-14T15:14:44

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

diff --git a/ChangeLog b/ChangeLog
index 29b3b6d..47a2551 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-12-14  Scott Long  <scott@swiftview.com>
+
+    * 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 <slouken@devolution.com>
 
     * builds/mac/freetype.mac: a new Makefile to build with MPW on MacOS
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 588ec41..0c5ee04 100644
--- 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 */