diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2009-11-10 10:20:49 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2009-11-10 10:20:49 +0000 |
commit | 3bb1571e68019ddbc4b3f1206a61a3a9fc55a9b1 (patch) | |
tree | 0ed98b035aec5328e364009c48c6a672d7fcbfac /Build/source/libs/xpdf/xpdf-3.02-PATCHES | |
parent | 5af5b70fa80778721dcea64995afc56815cee374 (diff) |
towards TL2010: libs/xpdf
git-svn-id: svn://tug.org/texlive/trunk@15956 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/xpdf/xpdf-3.02-PATCHES')
3 files changed, 262 insertions, 26 deletions
diff --git a/Build/source/libs/xpdf/xpdf-3.02-PATCHES/ChangeLog b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/ChangeLog index 14881ff72be..6d64ef89fd0 100644 --- a/Build/source/libs/xpdf/xpdf-3.02-PATCHES/ChangeLog +++ b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/ChangeLog @@ -1,3 +1,9 @@ +2009-09-15 Peter Breitenlohner <peb@mppmu.mpg.de> + + * patch-04-pl4 (new): Official 3.02pl4 patch plus change of + xpdfVersion "3.02pl3" -> "3.02pl4" + * patch-40-*: Adapted to presence of patch-04-pl4. + 2009-05-12 Peter Breitenlohner <peb@mppmu.mpg.de> * patch-16-size-of-struct (removed): unnecessary. @@ -38,9 +44,9 @@ 2009-04-30 Peter Breitenlohner <peb@mppmu.mpg.de> - * patch-02-pl3 (new): Official 3.02pl3 patch plus change of + * patch-03-pl3 (new): Official 3.02pl3 patch plus change of xpdfVersion "3.02pl2" -> "3.02pl3" - * patch-[12]?-*: adapted to presence of patch-01-pl3. + * patch-[12]?-*: adapted to presence of patch-03-pl3. 2009-04-02 Peter Breitenlohner <peb@mppmu.mpg.de> diff --git a/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-04-pl4 b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-04-pl4 new file mode 100644 index 00000000000..4008e7d2721 --- /dev/null +++ b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-04-pl4 @@ -0,0 +1,224 @@ + Official patch http://www.foolabs.com/xpdf/xpdf-3.02pl4.patch + + Update of xpdfVersion in xpdf-3.02/xpdf/config.h + +diff -ur -N xpdf-3.02.orig/splash/Splash.cc xpdf-3.02/splash/Splash.cc +--- xpdf-3.02.orig/splash/Splash.cc 2007-02-27 23:05:52.000000000 +0100 ++++ xpdf-3.02/splash/Splash.cc 2009-08-14 23:05:08.000000000 +0200 +@@ -12,6 +12,7 @@ + + #include <stdlib.h> + #include <string.h> ++#include <limits.h> + #include "gmem.h" + #include "SplashErrorCodes.h" + #include "SplashMath.h" +@@ -1912,7 +1913,10 @@ + xq = w % scaledWidth; + + // allocate pixel buffer +- pixBuf = (SplashColorPtr)gmalloc((yp + 1) * w); ++ if (yp < 0 || yp > INT_MAX - 1) { ++ return splashErrBadArg; ++ } ++ pixBuf = (SplashColorPtr)gmallocn(yp + 1, w); + + // initialize the pixel pipe + pipeInit(&pipe, 0, 0, state->fillPattern, NULL, state->fillAlpha, +@@ -2208,9 +2212,12 @@ + xq = w % scaledWidth; + + // allocate pixel buffers +- colorBuf = (SplashColorPtr)gmalloc((yp + 1) * w * nComps); ++ if (yp < 0 || yp > INT_MAX - 1 || w > INT_MAX / nComps) { ++ return splashErrBadArg; ++ } ++ colorBuf = (SplashColorPtr)gmallocn(yp + 1, w * nComps); + if (srcAlpha) { +- alphaBuf = (Guchar *)gmalloc((yp + 1) * w); ++ alphaBuf = (Guchar *)gmallocn(yp + 1, w); + } else { + alphaBuf = NULL; + } +diff -ur -N xpdf-3.02.orig/splash/SplashBitmap.cc xpdf-3.02/splash/SplashBitmap.cc +--- xpdf-3.02.orig/splash/SplashBitmap.cc 2007-02-27 23:05:52.000000000 +0100 ++++ xpdf-3.02/splash/SplashBitmap.cc 2009-08-19 23:35:39.000000000 +0200 +@@ -11,6 +11,7 @@ + #endif + + #include <stdio.h> ++#include <limits.h> + #include "gmem.h" + #include "SplashErrorCodes.h" + #include "SplashBitmap.h" +@@ -27,30 +28,48 @@ + mode = modeA; + switch (mode) { + case splashModeMono1: +- rowSize = (width + 7) >> 3; ++ if (width > 0) { ++ rowSize = (width + 7) >> 3; ++ } else { ++ rowSize = -1; ++ } + break; + case splashModeMono8: +- rowSize = width; ++ if (width > 0) { ++ rowSize = width; ++ } else { ++ rowSize = -1; ++ } + break; + case splashModeRGB8: + case splashModeBGR8: +- rowSize = width * 3; ++ if (width > 0 && width <= INT_MAX / 3) { ++ rowSize = width * 3; ++ } else { ++ rowSize = -1; ++ } + break; + #if SPLASH_CMYK + case splashModeCMYK8: +- rowSize = width * 4; ++ if (width > 0 && width <= INT_MAX / 4) { ++ rowSize = width * 4; ++ } else { ++ rowSize = -1; ++ } + break; + #endif + } +- rowSize += rowPad - 1; +- rowSize -= rowSize % rowPad; +- data = (SplashColorPtr)gmalloc(rowSize * height); ++ if (rowSize > 0) { ++ rowSize += rowPad - 1; ++ rowSize -= rowSize % rowPad; ++ } ++ data = (SplashColorPtr)gmallocn(height, rowSize); + if (!topDown) { + data += (height - 1) * rowSize; + rowSize = -rowSize; + } + if (alphaA) { +- alpha = (Guchar *)gmalloc(width * height); ++ alpha = (Guchar *)gmallocn(width, height); + } else { + alpha = NULL; + } +diff -ur -N xpdf-3.02.orig/splash/SplashErrorCodes.h xpdf-3.02/splash/SplashErrorCodes.h +--- xpdf-3.02.orig/splash/SplashErrorCodes.h 2007-02-27 23:05:52.000000000 +0100 ++++ xpdf-3.02/splash/SplashErrorCodes.h 2009-08-14 23:03:46.000000000 +0200 +@@ -29,4 +29,6 @@ + + #define splashErrSingularMatrix 8 // matrix is singular + ++#define splashErrBadArg 9 // bad argument ++ + #endif +diff -ur -N xpdf-3.02.orig/xpdf/PSOutputDev.cc xpdf-3.02/xpdf/PSOutputDev.cc +--- xpdf-3.02.orig/xpdf/PSOutputDev.cc 2007-02-27 23:05:52.000000000 +0100 ++++ xpdf-3.02/xpdf/PSOutputDev.cc 2009-10-02 21:38:58.000000000 +0200 +@@ -4301,7 +4301,7 @@ + width, -height, height); + + // allocate a line buffer +- lineBuf = (Guchar *)gmalloc(4 * width); ++ lineBuf = (Guchar *)gmallocn(width, 4); + + // set up to process the data stream + imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), +diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc +--- xpdf-3.02.orig/xpdf/Stream.cc 2007-11-12 13:27:21.000000000 +0100 ++++ xpdf-3.02/xpdf/Stream.cc 2009-10-05 20:07:49.000000000 +0200 +@@ -323,6 +323,10 @@ + } else { + imgLineSize = nVals; + } ++ if (width > INT_MAX / nComps) { ++ // force a call to gmallocn(-1,...), which will throw an exception ++ imgLineSize = -1; ++ } + imgLine = (Guchar *)gmallocn(imgLineSize, sizeof(Guchar)); + imgIdx = nVals; + } +diff -ur -N xpdf-3.02.orig/xpdf/XRef.cc xpdf-3.02/xpdf/XRef.cc +--- xpdf-3.02.orig/xpdf/XRef.cc 2007-02-27 23:05:52.000000000 +0100 ++++ xpdf-3.02/xpdf/XRef.cc 2009-08-14 23:05:08.000000000 +0200 +@@ -52,6 +52,8 @@ + // generation 0. + ObjectStream(XRef *xref, int objStrNumA); + ++ GBool isOk() { return ok; } ++ + ~ObjectStream(); + + // Return the object number of this object stream. +@@ -67,6 +69,7 @@ + int nObjects; // number of objects in the stream + Object *objs; // the objects (length = nObjects) + int *objNums; // the object numbers (length = nObjects) ++ GBool ok; + }; + + ObjectStream::ObjectStream(XRef *xref, int objStrNumA) { +@@ -80,6 +83,7 @@ + nObjects = 0; + objs = NULL; + objNums = NULL; ++ ok = gFalse; + + if (!xref->fetch(objStrNum, 0, &objStr)->isStream()) { + goto err1; +@@ -105,6 +109,13 @@ + goto err1; + } + ++ // this is an arbitrary limit to avoid integer overflow problems ++ // in the 'new Object[nObjects]' call (Acrobat apparently limits ++ // object streams to 100-200 objects) ++ if (nObjects > 1000000) { ++ error(-1, "Too many objects in an object stream"); ++ goto err1; ++ } + objs = new Object[nObjects]; + objNums = (int *)gmallocn(nObjects, sizeof(int)); + offsets = (int *)gmallocn(nObjects, sizeof(int)); +@@ -161,10 +172,10 @@ + } + + gfree(offsets); ++ ok = gTrue; + + err1: + objStr.free(); +- return; + } + + ObjectStream::~ObjectStream() { +@@ -837,6 +848,11 @@ + delete objStr; + } + objStr = new ObjectStream(this, e->offset); ++ if (!objStr->isOk()) { ++ delete objStr; ++ objStr = NULL; ++ goto err; ++ } + } + objStr->getObject(e->gen, num, obj); + break; +diff -ur -N xpdf-3.02.orig/xpdf/config.h xpdf-3.02/xpdf/config.h +--- xpdf-3.02.orig/xpdf/config.h 2009-03-31 19:55:23.000000000 +0200 ++++ xpdf-3.02/xpdf/config.h 2009-10-15 13:37:21.000000000 +0200 +@@ -17,7 +17,7 @@ + //------------------------------------------------------------------------ + + // xpdf version +-#define xpdfVersion "3.02pl3" ++#define xpdfVersion "3.02pl4" + #define xpdfVersionNum 3.02 + #define xpdfMajorVersion 3 + #define xpdfMinorVersion 2 diff --git a/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-40-objectStream-support-for-pdftosrc b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-40-objectStream-support-for-pdftosrc index 03d11926eaa..773080db9f5 100644 --- a/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-40-objectStream-support-for-pdftosrc +++ b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-40-objectStream-support-for-pdftosrc @@ -5,9 +5,9 @@ from: Han The Thanh <thanh@pdftex.org> -diff -ur -N xpdf-3.02.orig/xpdf/XRef.cc xpdf-3.02/xpdf/XRef.cc ---- xpdf-3.02.orig/xpdf/XRef.cc 2007-02-27 23:05:52.000000000 +0100 -+++ xpdf-3.02/xpdf/XRef.cc 2009-05-08 21:39:44.000000000 +0200 +diff -ur xpdf-3.02.orig/xpdf/XRef.cc xpdf-3.02/xpdf/XRef.cc +--- xpdf-3.02.orig/xpdf/XRef.cc 2009-08-14 23:05:08.000000000 +0200 ++++ xpdf-3.02/xpdf/XRef.cc 2009-10-15 14:32:25.000000000 +0200 @@ -5,6 +5,9 @@ // Copyright 1996-2003 Glyph & Cog, LLC // @@ -18,7 +18,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/XRef.cc xpdf-3.02/xpdf/XRef.cc #include <aconf.h> -@@ -45,34 +48,9 @@ +@@ -45,37 +48,9 @@ // ObjectStream //------------------------------------------------------------------------ @@ -29,6 +29,8 @@ diff -ur -N xpdf-3.02.orig/xpdf/XRef.cc xpdf-3.02/xpdf/XRef.cc - // generation 0. - ObjectStream(XRef *xref, int objStrNumA); - +- GBool isOk() { return ok; } +- - ~ObjectStream(); - - // Return the object number of this object stream. @@ -44,6 +46,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/XRef.cc xpdf-3.02/xpdf/XRef.cc - int nObjects; // number of objects in the stream - Object *objs; // the objects (length = nObjects) - int *objNums; // the object numbers (length = nObjects) +- GBool ok; -}; - ObjectStream::ObjectStream(XRef *xref, int objStrNumA) { @@ -53,15 +56,15 @@ diff -ur -N xpdf-3.02.orig/xpdf/XRef.cc xpdf-3.02/xpdf/XRef.cc Object objStr, obj1, obj2; int first, i; -@@ -80,6 +58,7 @@ +@@ -83,6 +58,7 @@ nObjects = 0; objs = NULL; objNums = NULL; + offsets = NULL; + ok = gFalse; if (!xref->fetch(objStrNum, 0, &objStr)->isStream()) { - goto err1; -@@ -100,6 +79,7 @@ +@@ -104,6 +80,7 @@ goto err1; } first = obj1.getInt(); @@ -69,34 +72,34 @@ diff -ur -N xpdf-3.02.orig/xpdf/XRef.cc xpdf-3.02/xpdf/XRef.cc obj1.free(); if (first < 0) { goto err1; -@@ -121,7 +101,7 @@ +@@ -132,7 +109,7 @@ obj1.free(); obj2.free(); delete parser; - gfree(offsets); -+// gfree(offsets); ++// gfree(offsets); goto err1; } objNums[i] = obj1.getInt(); -@@ -131,7 +111,7 @@ +@@ -142,7 +119,7 @@ if (objNums[i] < 0 || offsets[i] < 0 || (i > 0 && offsets[i] < offsets[i-1])) { delete parser; - gfree(offsets); -+// gfree(offsets); ++// gfree(offsets); goto err1; } } -@@ -160,7 +140,7 @@ +@@ -171,7 +148,7 @@ delete parser; } - gfree(offsets); -+// gfree(offsets); ++//gfree(offsets); + ok = gTrue; err1: - objStr.free(); -@@ -177,6 +157,7 @@ +@@ -188,6 +165,7 @@ delete[] objs; } gfree(objNums); @@ -104,9 +107,9 @@ diff -ur -N xpdf-3.02.orig/xpdf/XRef.cc xpdf-3.02/xpdf/XRef.cc } Object *ObjectStream::getObject(int objIdx, int objNum, Object *obj) { -diff -ur -N xpdf-3.02.orig/xpdf/XRef.h xpdf-3.02/xpdf/XRef.h +diff -ur xpdf-3.02.orig/xpdf/XRef.h xpdf-3.02/xpdf/XRef.h --- xpdf-3.02.orig/xpdf/XRef.h 2007-02-27 23:05:52.000000000 +0100 -+++ xpdf-3.02/xpdf/XRef.h 2009-05-08 21:39:41.000000000 +0200 ++++ xpdf-3.02/xpdf/XRef.h 2009-10-15 14:32:30.000000000 +0200 @@ -5,6 +5,9 @@ // Copyright 1996-2003 Glyph & Cog, LLC // @@ -117,7 +120,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/XRef.h xpdf-3.02/xpdf/XRef.h #ifndef XREF_H #define XREF_H -@@ -21,7 +24,36 @@ +@@ -21,7 +24,39 @@ class Dict; class Stream; class Parser; @@ -130,6 +133,8 @@ diff -ur -N xpdf-3.02.orig/xpdf/XRef.h xpdf-3.02/xpdf/XRef.h + // generation 0. + ObjectStream(XRef *xref, int objStrNumA); + ++ GBool isOk() { return ok; } ++ + ~ObjectStream(); + + // Return the object number of this object stream. @@ -144,18 +149,19 @@ diff -ur -N xpdf-3.02.orig/xpdf/XRef.h xpdf-3.02/xpdf/XRef.h + +private: + -+ int objStrNum; // object number of the object stream -+ int nObjects; // number of objects in the stream -+ Object *objs; // the objects (length = nObjects) -+ int *objNums; // the object numbers (length = nObjects) -+ int *offsets; // the object offsets (length = nObjects) ++ int objStrNum; // object number of the object stream ++ int nObjects; // number of objects in the stream ++ Object *objs; // the objects (length = nObjects) ++ int *objNums; // the object numbers (length = nObjects) ++ int *offsets; // the object offsets (length = nObjects) + Guint firstOffset; ++ GBool ok; +}; + //------------------------------------------------------------------------ // XRef -@@ -96,6 +128,7 @@ +@@ -96,6 +131,7 @@ int getSize() { return size; } XRefEntry *getEntry(int i) { return &entries[i]; } Object *getTrailerDict() { return &trailerDict; } |