[poppler] 3 commits - fofi/FoFiTrueType.cc

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


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

New commits:
commit 8ce31485faa26994c52f4d032cc5a8355aba23d1
Merge: 4589ce1 303287e
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Sep 26 00:40:43 2014 +0200

    Merge remote-tracking branch 'origin/poppler-0.26'

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) {
commit f94ba85a736b4c90c05e7782939f32506472658e
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Fri Sep 12 19:22:20 2014 +0200

    glib: Fix use of uninitialized members in PopplerInputStream
    
    https://bugs.freedesktop.org/show_bug.cgi?id=82630

diff --git a/glib/poppler-input-stream.cc b/glib/poppler-input-stream.cc
index 041cc2e..e57e344 100644
--- a/glib/poppler-input-stream.cc
+++ b/glib/poppler-input-stream.cc
@@ -31,6 +31,8 @@ PopplerInputStream::PopplerInputStream(GInputStream *inputStreamA, GCancellable
   length = lengthA;
   bufPtr = bufEnd = buf;
   bufPos = start;
+  savePos = 0;
+  saved = gFalse;
 }
 
 PopplerInputStream::~PopplerInputStream()
@@ -77,6 +79,7 @@ void PopplerInputStream::setPos(Goffset pos, int dir)
 
   if (dir >= 0) {
     g_seekable_seek(seekable, pos, G_SEEK_SET, cancellable, NULL);
+    bufPos = pos;
   } else {
     g_seekable_seek(seekable, 0, G_SEEK_END, cancellable, NULL);
     size = (Guint)g_seekable_tell(seekable);
@@ -110,7 +113,7 @@ GBool PopplerInputStream::fillBuf()
   if (limited && bufPos + inputStreamBufSize > start + length) {
     n = start + length - bufPos;
   } else {
-    n = inputStreamBufSize;
+    n = inputStreamBufSize - (bufPos % inputStreamBufSize);
   }
 
   n = g_input_stream_read(inputStream, buf, n, cancellable, NULL);


More information about the poppler mailing list