diff options
author | Albert Astals Cid <aacid@kde.org> | 2008-08-04 20:34:42 +0200 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2008-08-04 20:37:53 +0200 |
commit | 5ad1a12183f4b8e328f32386a74b5616e7e59070 (patch) | |
tree | c0adef2725c25f6f1bc8394ca314bdd2fe4a9b0e /fofi | |
parent | d322720428fa416b7d5f23acc72d1d4b4f74d041 (diff) |
Be less strict when parsing TTF tables
With this change and freetype from CVS i can render Bug 16940 using the splash renderer
Diffstat (limited to 'fofi')
-rw-r--r-- | fofi/FoFiTrueType.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc index d702123f..fc64be8b 100644 --- a/fofi/FoFiTrueType.cc +++ b/fofi/FoFiTrueType.cc @@ -20,6 +20,7 @@ #include "goo/GooHash.h" #include "FoFiType1C.h" #include "FoFiTrueType.h" +#include "Error.h" // // Terminology @@ -1874,6 +1875,7 @@ void FoFiTrueType::parse() { } tables = (TrueTypeTable *)gmallocn(nTables, sizeof(TrueTypeTable)); pos += 12; + int wrongTables = 0; for (i = 0; i < nTables; ++i) { tables[i].tag = getU32BE(pos, &parsedOk); tables[i].checksum = getU32BE(pos + 4, &parsedOk); @@ -1881,10 +1883,14 @@ void FoFiTrueType::parse() { tables[i].len = (int)getU32BE(pos + 12, &parsedOk); if (tables[i].offset + tables[i].len < tables[i].offset || tables[i].offset + tables[i].len > len) { - parsedOk = gFalse; + i--; + wrongTables++; + error(-1, "Found a bad table definition on true type definition, trying to continue..."); } pos += 16; } + nTables -= wrongTables; + tables = (TrueTypeTable *)greallocn(tables, nTables, sizeof(TrueTypeTable)); if (!parsedOk) { return; } |