[poppler] 2 commits - fofi/FoFiTrueType.cc poppler/SplashOutputDev.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Mon Aug 4 11:38:11 PDT 2008


 fofi/FoFiTrueType.cc       |    8 +++++++-
 poppler/SplashOutputDev.cc |    5 +++++
 2 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 5ad1a12183f4b8e328f32386a74b5616e7e59070
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Aug 4 20:34:42 2008 +0200

    Be less strict when parsing TTF tables
    
    With this change and freetype from CVS i can render Bug 16940 using the splash renderer

diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc
index d702123..fc64be8 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;
   }
commit d322720428fa416b7d5f23acc72d1d4b4f74d041
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Aug 4 20:16:50 2008 +0200

    Report an error when FoFiTrueType::load or FoFiTrueType::make fail

diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 823a1aa..a2f28b2 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -1125,7 +1125,12 @@ void SplashOutputDev::doUpdateFont(GfxState *state) {
 	else
 	  ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
 	if (! ff)
+	{
+	  error(-1, "Couldn't create a font for '%s'",
+	      gfxFont->getName() ? gfxFont->getName()->getCString()
+	                         : "(unnamed)");
 	  goto err2;
+	}
 	codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n);
 	delete ff;
       }


More information about the poppler mailing list