[poppler] Branch 'poppler-0.26' - fofi/FoFiTrueType.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Sep 25 15:26:14 PDT 2014


 fofi/FoFiTrueType.cc |   22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 303287ebdad0de9fb2655c4d7eab627c0045ea04
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date:   Fri Sep 26 00:25:38 2014 +0200

    Fix rendering of file with a wrong embedded font
    
    Bug #84270

diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc
index cd11d6f..456de90 100644
--- a/fofi/FoFiTrueType.cc
+++ b/fofi/FoFiTrueType.cc
@@ -20,6 +20,7 @@
 // Copyright (C) 2008 Tomas Are Haavet <tomasare at gmail.com>
 // Copyright (C) 2012 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
 // Copyright (C) 2012 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2014 Thomas Freitag <Thomas.Freitag at alfa.de>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -1421,7 +1422,7 @@ void FoFiTrueType::parse() {
 
 void FoFiTrueType::readPostTable() {
   GooString *name;
-  int tablePos, postFmt, stringIdx, stringPos;
+  int tablePos, postFmt, stringIdx, stringPos, savedStringIdx;
   GBool ok;
   int i, j, n, m;
 
@@ -1456,6 +1457,7 @@ void FoFiTrueType::readPostTable() {
 	nameToGID->removeInt(macGlyphNames[j]);
 	nameToGID->add(new GooString(macGlyphNames[j]), i);
       } else {
+	savedStringIdx = stringIdx;
 	j -= 258;
 	if (j != stringIdx) {
 	  for (stringIdx = 0, stringPos = tablePos + 34 + 2*n;
@@ -1467,13 +1469,17 @@ void FoFiTrueType::readPostTable() {
 	}
 	m = getU8(stringPos, &ok);
 	if (!ok || !checkRegion(stringPos + 1, m)) {
-	  goto err;
-	}
-	name = new GooString((char *)&file[stringPos + 1], m);
-	nameToGID->removeInt(name);
-	nameToGID->add(name, i);
-	++stringIdx;
-	stringPos += 1 + m;
+	  stringIdx = savedStringIdx;
+	  ok = gTrue;
+	  nameToGID->removeInt(macGlyphNames[j]);
+	  nameToGID->add(new GooString(macGlyphNames[0]), i);
+	} else {
+	  name = new GooString((char *)&file[stringPos + 1], m);
+	  nameToGID->removeInt(name);
+	  nameToGID->add(name, i);
+	  ++stringIdx;
+	  stringPos += 1 + m;
+        }
       }
     }
   } else if (postFmt == 0x00028000) {


More information about the poppler mailing list