[poppler] 10 commits - poppler/GfxFont.cc poppler/GfxState.cc poppler/JBIG2Stream.cc poppler/PageLabelInfo_p.h poppler/SplashOutputDev.cc poppler/XRef.cc splash/Splash.cc utils/pdfseparate.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Sun Apr 6 07:08:46 PDT 2014


 poppler/GfxFont.cc         |    8 ++++----
 poppler/GfxState.cc        |    2 +-
 poppler/JBIG2Stream.cc     |    4 ++--
 poppler/PageLabelInfo_p.h  |    8 +++++++-
 poppler/SplashOutputDev.cc |    3 ++-
 poppler/XRef.cc            |    3 ++-
 splash/Splash.cc           |    4 +++-
 utils/pdfseparate.cc       |    4 ++--
 8 files changed, 23 insertions(+), 13 deletions(-)

New commits:
commit b8325316e41fb03eb5fac5c80d6a550fe9ce9695
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Apr 6 16:05:51 2014 +0200

    Fix memory leak
    
    CID #16943

diff --git a/utils/pdfseparate.cc b/utils/pdfseparate.cc
index 78dbf12..31dc18c 100644
--- a/utils/pdfseparate.cc
+++ b/utils/pdfseparate.cc
@@ -5,7 +5,7 @@
 // This file is licensed under the GPLv2 or later
 //
 // Copyright (C) 2011, 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
-// Copyright (C) 2012, 2013 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2012-2014 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2013 Pino Toscano <pino at kde.org>
 // Copyright (C) 2013 Daniel Kahn Gillmor <dkg at fifthhorseman.net>
 // Copyright (C) 2013 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
@@ -62,7 +62,6 @@ bool extractPages (const char *srcFileName, const char *destFileName) {
   // by 'A' (random char that is not %), if at the end of replacing
   // any of the valid appearances there is still any % around, the
   // pattern is wrong
-  char *auxDestFileName = strdup(destFileName);
   if (firstPage == 0 && lastPage == 0) {
     firstPage = 1;
     lastPage = doc->getNumPages();
@@ -78,6 +77,7 @@ bool extractPages (const char *srcFileName, const char *destFileName) {
     return false;
   }
   bool foundmatch = false;
+  char *auxDestFileName = strdup(destFileName);
   char *p = strstr(auxDestFileName, "%d");
   if (p != NULL) {
     foundmatch = true;
commit ca9713118d6ce3fdd245f9ca4f595229a5be19c3
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Apr 6 15:59:43 2014 +0200

    Don't check twice for the same variable ^_^
    
    CID #16804

diff --git a/splash/Splash.cc b/splash/Splash.cc
index aa46494..8d0765b 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -3842,7 +3842,7 @@ SplashError Splash::arbitraryTransformImage(SplashImageSource src, void *srcData
     scaledWidth = yMax - yMin;
     scaledHeight = xMax - xMin;
   }
-  if (scaledHeight <= 1 || scaledHeight <= 1 || tilingPattern) {
+  if (scaledHeight <= 1 || scaledWidth <= 1 || tilingPattern) {
     if (mat[0] >= 0) {
       t0 = imgCoordMungeUpper(mat[0] + mat[4]) - imgCoordMungeLower(mat[4]);
     } else {
commit 0ef290a7c5a8fa54d3fe0f646abdf098443a7a67
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Apr 6 15:57:38 2014 +0200

    Fix memory leak
    
    CID #16852

diff --git a/splash/Splash.cc b/splash/Splash.cc
index b303cf2..aa46494 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -2511,6 +2511,8 @@ SplashError Splash::fillWithPattern(SplashPath *path, GBool eo,
     delta = (yMinI == yMaxI) ? yMaxFP - yMinFP : xMaxFP - xMinFP;
     if (delta < 0.2) {
       opClipRes = splashClipAllOutside;
+      delete scanner;
+      delete xPath;
       return splashOk;
     }
   }
commit 8810b8917fded340b784873a91ca025b0bb49f3d
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Apr 6 15:49:18 2014 +0200

    Fix Out-of-bounds read
    
    CID #16844

diff --git a/poppler/PageLabelInfo_p.h b/poppler/PageLabelInfo_p.h
index d3cd89f..6cd5220 100644
--- a/poppler/PageLabelInfo_p.h
+++ b/poppler/PageLabelInfo_p.h
@@ -3,7 +3,7 @@
 // This file is under the GPLv2 or later license
 //
 // Copyright (C) 2005-2006 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2005, 2009 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2009, 2014 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2011 Simon Kellner <kellner at kit.edu>
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
 //
@@ -15,6 +15,7 @@
 /* http://mathworld.wolfram.com/RomanNumerals.html */
 
 #include "goo/GooString.h"
+#include "Error.h"
 
 static int fromRoman(const char *buffer) {
   int digit_value, prev_digit_value, value;
@@ -73,6 +74,11 @@ static void toRoman(int number, GooString *str, GBool uppercase) {
   int i, j, k;
   const char *wh;
 
+  if (number >= 4000) {
+    error(errUnimplemented, -1, "Conversion to roman numberals of numbers >= 4000 not implemented");
+    return;
+  }
+
   if (uppercase)
     wh = uppercaseNumerals;
   else
commit 9309907673e8557a25021dce79d9b4354640e2d0
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Apr 6 15:35:00 2014 +0200

    Fix memory leak
    
    Don't pass new'ed GooStrings as parameters to error()
    
    CID #16915

diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index 9eadcc7..5a13eca 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -764,8 +764,8 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, GBool ps) {
     }
     substName = new GooString(base14SubstFonts[substIdx]);
     if (ps) {
-      error(errSyntaxWarning, -1, "Substituting font '{0:s}' for '{1:t}'",
-	    base14SubstFonts[substIdx], name ? name : new GooString("null"));
+      error(errSyntaxWarning, -1, "Substituting font '{0:s}' for '{1:s}'",
+	    base14SubstFonts[substIdx], name ? name->getCString() : "null");
       fontLoc = new GfxFontLoc();
       fontLoc->locType = gfxFontLocResident;
       fontLoc->fontType = fontType1;
@@ -777,8 +777,8 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, GBool ps) {
       delete substName;
       if (path) {
 	if ((fontLoc = getExternalFont(path, gFalse))) {
-	  error(errSyntaxWarning, -1, "Substituting font '{0:s}' for '{1:t}'",
-		  base14SubstFonts[substIdx], (name == NULL) ? new GooString("") : name);
+	  error(errSyntaxWarning, -1, "Substituting font '{0:s}' for '{1:s}'",
+		  base14SubstFonts[substIdx], name ? name->getCString() : "");
 	  name = new GooString(base14SubstFonts[substIdx]);
 	  fontLoc->substIdx = substIdx;
 	  return fontLoc;
commit a511005584a38217fed582ced6ce2c937526cf96
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Apr 6 15:28:50 2014 +0200

    Fix Uninitialized pointer read when nFucnsA is 0
    
    CID #16965

diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index addba68..eb11777 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -3720,7 +3720,7 @@ GfxFunctionShading *GfxFunctionShading::parse(Dict *dict, OutputDev *out, GfxSta
   dict->lookup("Function", &obj1);
   if (obj1.isArray()) {
     nFuncsA = obj1.arrayGetLength();
-    if (nFuncsA > gfxColorMaxComps) {
+    if (nFuncsA > gfxColorMaxComps || nFuncsA <= 0) {
       error(errSyntaxWarning, -1, "Invalid Function array in shading dictionary");
       goto err1;
     }
commit 26b961a64030d91c5db2769dcd0ab8dff7b9b6a6
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Apr 6 15:23:35 2014 +0200

    gfree -> delete since it was new'ed
    
    CID #16786

diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index e5e9f17..0695dc5 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -2290,7 +2290,7 @@ void JBIG2Stream::readTextRegionSeg(Guint segNum, GBool imm,
 
  codeTableError:
   error(errSyntaxError, curStr->getPos(), "Missing code table in JBIG2 text region");
-  gfree(codeTables);
+  delete codeTables;
   gfree(syms);
   return;
 
commit 814ac2230b594cce3b871588804dd92f4a187e7e
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Apr 6 15:22:13 2014 +0200

    delete -> gfree since it was gmaloced
    
    CID #16785

diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index 4c55123..e5e9f17 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -2291,7 +2291,7 @@ void JBIG2Stream::readTextRegionSeg(Guint segNum, GBool imm,
  codeTableError:
   error(errSyntaxError, curStr->getPos(), "Missing code table in JBIG2 text region");
   gfree(codeTables);
-  delete syms;
+  gfree(syms);
   return;
 
  eofError:
commit b496b6665803247b10b018ae939a2a452fa4a48f
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Apr 6 15:17:50 2014 +0200

    Fix memory leak
    
    CID #16864

diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index d0a9454..01979fd 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2005 Takashi Iwai <tiwai at suse.de>
 // Copyright (C) 2006 Stefan Schweizer <genstef at gentoo.org>
-// Copyright (C) 2006-2013 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006-2014 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
 // Copyright (C) 2006 Scott Turner <scotty1024 at mac.com>
 // Copyright (C) 2007 Koji Otani <sho at bbr.jp>
@@ -4346,6 +4346,7 @@ GBool SplashOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTria
     setVectorAntialias(vaa);
     return retVal;
   }
+  delete splashShading;
   return gFalse;
 }
 
commit 1b612f355e9f29fa93c15a9de1188049a8e086b6
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Apr 6 15:14:50 2014 +0200

    Fix memory leak
    
    CID #16853

diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index 5495b62..2560e3d 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2005 Dan Sheridan <dan.sheridan at postman.org.uk>
 // Copyright (C) 2005 Brad Hards <bradh at frogmouth.net>
-// Copyright (C) 2006, 2008, 2010, 2012, 2013 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006, 2008, 2010, 2012-2014 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2007-2008 Julien Rebetez <julienr at svn.gnome.org>
 // Copyright (C) 2007 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2009, 2010 Ilya Gorenbein <igorenbein at finjan.com>
@@ -435,6 +435,7 @@ XRef *XRef::copy() {
 
   if (xref->reserve(size) == 0) {
     error(errSyntaxError, -1, "unable to allocate {0:d} entries", size);
+    delete xref;
     return NULL;
   }
   xref->size = size;


More information about the poppler mailing list