Commit 3033f4366b68024ca56f53a53e568e1805436446

Werner Lemberg 2007-07-04T14:12:19

* src/truetype/ttgload.c (load_truetype_glyph): Always allow a recursion depth of 1. This was the maximum value in TrueType 1.0, and some older fonts don't set this field correctly. * src/gxvalid/gxvmort1.c (gxv_mort_subtable_type1_substTable_validate): Fix tracing message.

diff --git a/ChangeLog b/ChangeLog
index 6184575..c5b80ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,13 @@
 	* docs/PROBLEMS: Mention that some PS based fonts can't be
 	handled correctly by FreeType.
 
+	* src/truetype/ttgload.c (load_truetype_glyph): Always allow a
+	recursion depth of 1.  This was the maximum value in TrueType 1.0,
+	and some older fonts don't set this field correctly.
+
+	* src/gxvalid/gxvmort1.c
+	(gxv_mort_subtable_type1_substTable_validate): Fix tracing message.
+
 2007-07-03  Werner Lemberg  <wl@gnu.org>
 
 	* src/autofit/aflatin.c (af_latin_metrics_init_blues): Initialize
diff --git a/src/gxvalid/gxvmort1.c b/src/gxvalid/gxvmort1.c
index 0575b12..711bbd0 100644
--- a/src/gxvalid/gxvmort1.c
+++ b/src/gxvalid/gxvmort1.c
@@ -202,7 +202,7 @@
 
       if ( dst_gid > valid->face->num_glyphs )
       {
-        GXV_TRACE(( "substTable include toolarge gid[%d]=%d >"
+        GXV_TRACE(( "substTable include too large gid[%d]=%d >"
                     " max defined gid #%d\n",
                     i, dst_gid, valid->face->num_glyphs ));
         if ( valid->root->level >= FT_VALIDATE_PARANOID )
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index ae476a4..29736ab 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1084,7 +1084,9 @@
 #endif
 
 
-    if ( recurse_count > face->max_profile.maxComponentDepth )
+    /* some fonts haven't this field set correctly, */
+    /* thus we add 1 to catch the majority of them  */
+    if ( recurse_count > (FT_UInt)face->max_profile.maxComponentDepth + 1 )
     {
       error = TT_Err_Invalid_Composite;
       goto Exit;