[poppler] 3 commits - fofi/FoFiType1C.cc poppler/SplashOutputDev.cc poppler/XRef.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Tue May 1 00:48:14 UTC 2018


 fofi/FoFiType1C.cc         |    7 ++++---
 poppler/SplashOutputDev.cc |    7 +++++++
 poppler/XRef.cc            |   16 ++++++++--------
 3 files changed, 19 insertions(+), 11 deletions(-)

New commits:
commit 60b4fe65bc9dc9b82bbadf0be2e3781be796a13d
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue May 1 02:46:17 2018 +0200

    FoFiType1C::cvtGlyph: Fix infinite recursion on malformed documents
    
    Bugs #104942, #103238

diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc
index 03e77993..b14561ff 100644
--- a/fofi/FoFiType1C.cc
+++ b/fofi/FoFiType1C.cc
@@ -13,7 +13,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2009, 2010, 2017 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2009, 2010, 2017, 2018 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
 //
 // To see a description of the changes please see the Changelog file that
@@ -32,6 +32,7 @@
 #include <math.h>
 #include "goo/gmem.h"
 #include "goo/gstrtod.h"
+#include "goo/GooLikely.h"
 #include "goo/GooString.h"
 #include "poppler/Error.h"
 #include "FoFiEncodings.h"
@@ -1361,7 +1362,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf,
 	  --nOps;
 	  ok = gTrue;
 	  getIndexVal(subrIdx, k, &val, &ok);
-	  if (ok) {
+	  if (likely(ok && val.pos != offset)) {
 	    cvtGlyph(val.pos, val.len, charBuf, subrIdx, pDict, gFalse);
 	  }
 	} else {
@@ -1596,7 +1597,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf,
 	  --nOps;
 	  ok = gTrue;
 	  getIndexVal(&gsubrIdx, k, &val, &ok);
-	  if (ok) {
+	  if (likely(ok && val.pos != offset)) {
 	    cvtGlyph(val.pos, val.len, charBuf, subrIdx, pDict, gFalse);
 	  }
 	} else {
commit 8429a67536b7c2f6d752e4a522ee98e6f76a40f9
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue May 1 02:44:37 2018 +0200

    XRef: Fix runtime undefined behaviour
    
    Going to the position -1 of an array is undefined behaviour, so don't do
    it
    
    Bug #105970

diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index 5d3b98ff..25bc18a4 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -940,11 +940,11 @@ GBool XRef::constructXRef(GBool *wasReconstructed, GBool needCatalogDict) {
           if ((*p & 0xff) == 0) {
             //new line, continue with next line!
             str->getLine(buf, 256);
-            p = buf - 1;
-          }
-	  do {
+            p = buf;
+          } else {
 	    ++p;
-	  } while (*p && isspace(*p & 0xff));
+	  }
+	  while (*p && isspace(*p & 0xff)) ++p;
 	  if (isdigit(*p & 0xff)) {
 	    gen = atoi(p);
 	    do {
@@ -954,11 +954,11 @@ GBool XRef::constructXRef(GBool *wasReconstructed, GBool needCatalogDict) {
               if ((*p & 0xff) == 0) {
                 //new line, continue with next line!
                 str->getLine(buf, 256);
-                p = buf - 1;
-              }
-	      do {
+                p = buf;
+              } else {
 		++p;
-	      } while (*p && isspace(*p & 0xff));
+	      }
+	      while (*p && isspace(*p & 0xff)) ++p;
 	      if (!strncmp(p, "obj", 3)) {
 		if (num >= size) {
 		  newSize = (num + 1 + 255) & ~255;
commit 9d42769705180d6df4ba8415849ef8790a0e9b1d
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue May 1 02:43:21 2018 +0200

    Add the invisible character check to SplashOutputDev::beginType3Char
    
    Bug #106244

diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 73963302..a19e8c66 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -2512,6 +2512,13 @@ GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y,
   double x1, y1, xMin, yMin, xMax, yMax, xt, yt;
   int i, j;
 
+  // check for invisible text -- this is used by Acrobat Capture
+  if (state->getRender() == 3) {
+    // this is a bit of cheating, we say yes, font is already on cache
+    // so we actually skip the rendering of it
+    return gTrue;
+  }
+
   if (skipHorizText || skipRotatedText) {
     state->getFontTransMat(&m[0], &m[1], &m[2], &m[3]);
     horiz = m[0] > 0 && fabs(m[1]) < 0.001 &&


More information about the poppler mailing list