Commit 274207eb9a0e3bb20edf30e9a62e25120d5d15e5

Werner Lemberg 2013-07-18T12:38:57

[sfnt] Ignore invalid magic number in `head' or `bhed'. Other font engines seem to ignore it also. Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>. * src/sfnt/ttload.c (check_table_dir): Don't abort but warn only if we have an invalid magic number.

diff --git a/ChangeLog b/ChangeLog
index bf47171..dc27c1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2013-07-18  Werner Lemberg  <wl@gnu.org>
+
+	[sfnt] Ignore invalid magic number in `head' or `bhed'.
+
+	Other font engines seem to ignore it also.  Problem reported by
+	Hin-Tak Leung <htl10@users.sourceforge.net>.
+
+	* src/sfnt/ttload.c (check_table_dir): Don't abort but warn only if
+	we have an invalid magic number.
+
 2013-07-16  Werner Lemberg  <wl@gnu.org>
 
 	[smooth] Fix segfault caused by previous commit.
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index fbe70f7..89a8ae0 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -236,7 +236,8 @@
          */
         if ( table.Length < 0x36 )
         {
-          FT_TRACE2(( "check_table_dir: `head' table too small\n" ));
+          FT_TRACE2(( "check_table_dir:"
+                      " `head' or `bhed' table too small\n" ));
           error = FT_THROW( Table_Missing );
           goto Exit;
         }
@@ -246,12 +247,8 @@
           goto Exit;
 
         if ( magic != 0x5F0F3CF5UL )
-        {
           FT_TRACE2(( "check_table_dir:"
-                      " no magic number found in `head' table\n"));
-          error = FT_THROW( Table_Missing );
-          goto Exit;
-        }
+                      " invalid magic number in `head' or `bhed' table\n"));
 
         if ( FT_STREAM_SEEK( offset + ( nn + 1 ) * 16 ) )
           goto Exit;