Commit 79c23ae28a09255dbb10033e5eca6e2b6c86fcf0

David Turner 2003-01-22T22:53:55

* src/sfnt/ttload.c (sfnt_dir_check): relaxed the "head" table size verification to accept a few broken fonts who pad the size incorrectly (the table should be padded, but its "size" field shouldn't per se the spec)

diff --git a/ChangeLog b/ChangeLog
index 25ff94c..ed49c4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,10 @@
       adding a new API, named FT_Get_BDF_Property to retrieve the BDF
       properties of a given PCF or BDF font
 
+    * src/sfnt/ttload.c (sfnt_dir_check): relaxed the "head" table size
+    verification to accept a few broken fonts who pad the size incorrectly
+    (the table should be padded, but its "size" field shouldn't per se
+     the spec)
 
 2003-01-18  Werner Lemberg  <wl@gnu.org>
 
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index c4a5960..530dff6 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -213,7 +213,14 @@
 
         has_head = 1;
 
-        if ( table.Length != 0x36                ||
+       /* the table length should be 0x36, but certain font tools
+        * make it 0x38, so we will just check that it is greater.
+        *
+        * note that according to the specification,
+        * the table must be padded to 32-bit lengths, but this doesn't
+        * apply to the value of its "Length" field !!
+        */
+        if ( table.Length < 0x36                 ||
              FT_STREAM_SEEK( table.Offset + 12 ) ||
              FT_READ_ULONG( magic )              ||
              magic != 0x5F0F3CF5UL               )