1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-26 09:46:09 +00:00

- Update to 0.40a.

PR:		190823
Submitted by:	Carlos Jacobo Puga Medina <cjpugmed@gmail.com>
This commit is contained in:
Raphael Kubo da Costa 2014-06-20 18:37:53 +00:00
parent 62d60175bb
commit fcc60b2d0d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=358626
12 changed files with 4 additions and 386 deletions

View File

@ -2,10 +2,9 @@
# $FreeBSD$
PORTNAME= pdftohtml
PORTVERSION= 0.39
PORTREVISION= 7
PORTVERSION= 0.40a
CATEGORIES= textproc
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/${PORTNAME}-${PORTVERSION}
MASTER_SITES= http://fossies.org/linux/www/
MAINTAINER= ports@FreeBSD.org
COMMENT= Command-line tool for converting pdf-files into html

View File

@ -1,2 +1,2 @@
SHA256 (pdftohtml-0.39.tar.gz) = a27081e595e268f73d153ff42f0f406166fcd4978e634f0dedde0fb21ba37f50
SIZE (pdftohtml-0.39.tar.gz) = 339831
SHA256 (pdftohtml-0.40a.tar.gz) = 277ec1c75231b0073a458b1bfa2f98b7a115f5565e53494822ec7f0bcd8d4655
SIZE (pdftohtml-0.40a.tar.gz) = 498861

View File

@ -1,253 +0,0 @@
Index: xpdf/Stream.h
===================================================================
--- xpdf/Stream.h
+++ xpdf/Stream.h
@@ -233,6 +233,8 @@ public:
~StreamPredictor();
+ GBool isOk() { return ok; }
+
int lookChar();
int getChar();
@@ -250,6 +252,7 @@ private:
int rowBytes; // bytes per line
Guchar *predLine; // line buffer
int predIdx; // current index in predLine
+ GBool ok;
};
//------------------------------------------------------------------------
Index: xpdf/Stream.cc
===================================================================
--- xpdf/Stream.cc
+++ xpdf/Stream.cc
@@ -15,6 +15,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
+#include <limits.h>
#ifndef WIN32
#include <unistd.h>
#endif
@@ -412,13 +413,28 @@ StreamPredictor::StreamPredictor(Stream
width = widthA;
nComps = nCompsA;
nBits = nBitsA;
+ predLine = NULL;
+ ok = gFalse;
+ if (width <= 0 || nComps <= 0 || nBits <= 0 ||
+ nComps >= INT_MAX/nBits ||
+ width >= INT_MAX/nComps/nBits) {
+ return;
+ }
nVals = width * nComps;
+ if (nVals * nBits + 7 <= 0) {
+ return;
+ }
pixBytes = (nComps * nBits + 7) >> 3;
rowBytes = ((nVals * nBits + 7) >> 3) + pixBytes;
+ if (rowBytes < 0) {
+ return;
+ }
predLine = (Guchar *)gmalloc(rowBytes);
memset(predLine, 0, rowBytes);
predIdx = rowBytes;
+
+ ok = gTrue;
}
StreamPredictor::~StreamPredictor() {
@@ -1012,6 +1028,10 @@ LZWStream::LZWStream(Stream *strA, int p
FilterStream(strA) {
if (predictor != 1) {
pred = new StreamPredictor(this, predictor, columns, colors, bits);
+ if (!pred->isOk()) {
+ delete pred;
+ pred = NULL;
+ }
} else {
pred = NULL;
}
@@ -1260,6 +1280,10 @@ CCITTFaxStream::CCITTFaxStream(Stream *s
endOfLine = endOfLineA;
byteAlign = byteAlignA;
columns = columnsA;
+ if (columns < 1 || columns >= INT_MAX / sizeof(short)) {
+ error(-1, "invalid number of columns: %d", columns);
+ exit(1);
+ }
rows = rowsA;
endOfBlock = endOfBlockA;
black = blackA;
@@ -2897,6 +2921,11 @@ GBool DCTStream::readBaselineSOF() {
height = read16();
width = read16();
numComps = str->getChar();
+ if (numComps <= 0 || numComps > 4) {
+ numComps = 0;
+ error(getPos(), "Bad number of components in DCT stream");
+ return gFalse;
+ }
if (prec != 8) {
error(getPos(), "Bad DCT precision %d", prec);
return gFalse;
@@ -2923,6 +2952,11 @@ GBool DCTStream::readProgressiveSOF() {
height = read16();
width = read16();
numComps = str->getChar();
+ if (numComps <= 0 || numComps > 4) {
+ numComps = 0;
+ error(getPos(), "Bad number of components in DCT stream");
+ return gFalse;
+ }
if (prec != 8) {
error(getPos(), "Bad DCT precision %d", prec);
return gFalse;
@@ -2945,6 +2979,11 @@ GBool DCTStream::readScanInfo() {
length = read16() - 2;
scanInfo.numComps = str->getChar();
+ if (scanInfo.numComps <= 0 || scanInfo.numComps > 4) {
+ scanInfo.numComps = 0;
+ error(getPos(), "Bad number of components in DCT stream");
+ return gFalse;
+ }
--length;
if (length != 2 * scanInfo.numComps + 3) {
error(getPos(), "Bad DCT scan info block");
@@ -3019,12 +3058,12 @@ GBool DCTStream::readHuffmanTables() {
while (length > 0) {
index = str->getChar();
--length;
- if ((index & 0x0f) >= 4) {
+ if ((index & ~0x10) >= 4 || (index & ~0x10) < 0) {
error(getPos(), "Bad DCT Huffman table");
return gFalse;
}
if (index & 0x10) {
- index &= 0x0f;
+ index &= 0x03;
if (index >= numACHuffTables)
numACHuffTables = index+1;
tbl = &acHuffTables[index];
@@ -3142,9 +3181,11 @@ int DCTStream::readMarker() {
do {
do {
c = str->getChar();
+ if(c == EOF) return EOF;
} while (c != 0xff);
do {
c = str->getChar();
+ if(c == EOF) return EOF;
} while (c == 0xff);
} while (c == 0x00);
return c;
@@ -3255,6 +3296,10 @@ FlateStream::FlateStream(Stream *strA, i
FilterStream(strA) {
if (predictor != 1) {
pred = new StreamPredictor(this, predictor, columns, colors, bits);
+ if (!pred->isOk()) {
+ delete pred;
+ pred = NULL;
+ }
} else {
pred = NULL;
}
Index: xpdf/JBIG2Stream.cc
===================================================================
--- xpdf/JBIG2Stream.cc
+++ xpdf/JBIG2Stream.cc
@@ -7,6 +7,7 @@
//========================================================================
#include <aconf.h>
+#include <limits.h>
#ifdef USE_GCC_PRAGMAS
#pragma implementation
@@ -681,7 +682,16 @@ JBIG2Bitmap::JBIG2Bitmap(Guint segNumA,
w = wA;
h = hA;
line = (wA + 7) >> 3;
- data = (Guchar *)gmalloc(h * line);
+
+ if (h < 0 || line <= 0 || h >= (INT_MAX - 1) / line) {
+ error(-1, "invalid width/height");
+ data = NULL;
+ return;
+ }
+
+ // need to allocate one extra guard byte for use in combine()
+ data = (Guchar *)gmalloc(h * line + 1);
+ data[h * line] = 0;
}
JBIG2Bitmap::JBIG2Bitmap(Guint segNumA, JBIG2Bitmap *bitmap):
@@ -690,8 +700,17 @@ JBIG2Bitmap::JBIG2Bitmap(Guint segNumA,
w = bitmap->w;
h = bitmap->h;
line = bitmap->line;
- data = (Guchar *)gmalloc(h * line);
+
+ if (h < 0 || line <= 0 || h >= (INT_MAX - 1) / line) {
+ error(-1, "invalid width/height");
+ data = NULL;
+ return;
+ }
+
+ // need to allocate one extra guard byte for use in combine()
+ data = (Guchar *)gmalloc(h * line + 1);
memcpy(data, bitmap->data, h * line);
+ data[h * line] = 0;
}
JBIG2Bitmap::~JBIG2Bitmap() {
@@ -716,10 +735,14 @@ JBIG2Bitmap *JBIG2Bitmap::getSlice(Guint
}
void JBIG2Bitmap::expand(int newH, Guint pixel) {
- if (newH <= h) {
+ if (newH <= h || line <= 0 || newH >= (INT_MAX - 1) / line) {
+ error(-1, "invalid width/height");
+ gfree(data);
+ data = NULL;
return;
}
- data = (Guchar *)grealloc(data, newH * line);
+ // need to allocate one extra guard byte for use in combine()
+ data = (Guchar *)grealloc(data, newH * line + 1);
if (pixel) {
memset(data + h * line, 0xff, (newH - h) * line);
} else {
@@ -2256,6 +2279,15 @@ void JBIG2Stream::readHalftoneRegionSeg(
error(getPos(), "Bad symbol dictionary reference in JBIG2 halftone segment");
return;
}
+ if (gridH == 0 || gridW >= INT_MAX / gridH) {
+ error(getPos(), "Bad size in JBIG2 halftone segment");
+ return;
+ }
+ if (w == 0 || h >= INT_MAX / w) {
+ error(getPos(), "Bad size in JBIG2 bitmap segment");
+ return;
+ }
+
patternDict = (JBIG2PatternDict *)seg;
bpp = 0;
i = 1;
@@ -2887,6 +2919,11 @@ JBIG2Bitmap *JBIG2Stream::readGenericRef
JBIG2BitmapPtr tpgrCXPtr0, tpgrCXPtr1, tpgrCXPtr2;
int x, y, pix;
+ if (w < 0 || h <= 0 || w >= INT_MAX / h) {
+ error(-1, "invalid width/height");
+ return NULL;
+ }
+
bitmap = new JBIG2Bitmap(0, w, h);
bitmap->clearToZero();
# vim: syntax=diff

View File

@ -1,11 +0,0 @@
--- aconf.h.orig Wed Jun 25 00:41:27 2003
+++ aconf.h Wed Jun 25 09:27:43 2003
@@ -51,7 +51,7 @@
/* #undef HAVE_BSTRING_H */
#define HAVE_POPEN 1
#define HAVE_MKSTEMP 1
-#define HAVE_MKSTEMPS 0
+#define HAVE_MKSTEMPS 1
/* #undef SELECT_TAKES_INT */
#define GHOSTSCRIPT "gs"

View File

@ -1,22 +0,0 @@
--- xpdf/Stream.cc.orig 2009-04-29 01:11:24.000000000 +0400
+++ xpdf/Stream.cc 2009-04-29 01:15:47.000000000 +0400
@@ -33,6 +33,7 @@
#include "JBIG2Stream.h"
#include "JPXStream.h"
#include "Stream-CCITT.h"
+#include "Function.h"
#ifdef __DJGPP__
static GBool setDJSYSFLAGS = gFalse;
@@ -417,8 +418,9 @@
ok = gFalse;
if (width <= 0 || nComps <= 0 || nBits <= 0 ||
- nComps >= INT_MAX/nBits ||
- width >= INT_MAX/nComps/nBits) {
+ nComps > funcMaxOutputs || nBits > 16 ||
+ width >= INT_MAX / nComps ||
+ nVals >= (INT_MAX - 7) / nBits) {
return;
}
nVals = width * nComps;

View File

@ -1,14 +0,0 @@
--- fofi/Makefile.orig 2011-12-19 11:57:17.000000000 +0000
+++ fofi/Makefile 2011-12-19 12:14:09.000000000 +0000
@@ -14,9 +14,9 @@
GOOSRCDIR = $(srcdir)/../goo
GOOLIBDIR = ../goo
-CXXFLAGS = -DHAVE_CONFIG_H -I.. -I$(GOOSRCDIR) -I$(srcdir)
+CXXFLAGS += -DHAVE_CONFIG_H -I.. -I$(GOOSRCDIR) -I$(srcdir)
-CXX = g++
+CXX ?= g++
AR = ar rc
RANLIB = ranlib

View File

@ -1,17 +0,0 @@
$FreeBSD$
--- splash/Makefile
+++ splash/Makefile
@@ -16,9 +16,9 @@
FOFISRCDIR = $(srcdir)/../fofi
FOFILIBDIR = ../fofi
-CXXFLAGS = -DHAVE_CONFIG_H -I.. -I$(GOOSRCDIR) -I$(FOFISRCDIR) -I$(srcdir)
+CXXFLAGS += -DHAVE_CONFIG_H -I.. -I$(GOOSRCDIR) -I$(FOFISRCDIR) -I$(srcdir)
-CXX = g++
+CXX ?= g++
AR = ar rc
RANLIB = ranlib

View File

@ -1,11 +0,0 @@
--- src/HtmlLinks.h.orig Wed Mar 28 04:13:45 2007
+++ src/HtmlLinks.h Wed Mar 28 04:13:56 2007
@@ -19,7 +19,7 @@
HtmlLink& operator=(const HtmlLink& x);
HtmlLink(double xmin,double ymin,double xmax,double ymax,GString *_dest);
~HtmlLink();
- GBool HtmlLink::isEqualDest(const HtmlLink& x) const;
+ GBool isEqualDest(const HtmlLink& x) const;
GString *getDest(){return new GString(dest);}
double getX1() const {return Xmin;}
double getX2() const {return Xmax;}

View File

@ -1,12 +0,0 @@
--- xpdf/XRef.cc.orig Wed Jun 25 00:41:27 2003
+++ xpdf/XRef.cc Fri Jan 28 14:25:54 2005
@@ -486,6 +486,9 @@
} else {
keyLength = 5;
}
+ if (keyLength > 16) {
+ keyLength = 16;
+ }
permFlags = permissions.getInt();
if (encVersion >= 1 && encVersion <= 2 &&
encRevision >= 2 && encRevision <= 3) {

View File

@ -1,14 +0,0 @@
$FreeBSD$
--- src/Makefile
+++ src/Makefile
@@ -11,7 +11,7 @@
SPLASHSRCDIR = ../splash
SPLASHLIBDIR = ../splash
-CXXFLAGS = -DHAVE_CONFIG_H -DHAVE_DIRENT_H=1 -I.. -DHAVE_REWINDDIR=1 -DHAVE_POPEN=1 -I.. -I$(GOOSRCDIR) -I$(XPDFSRCDIR) -I$(FOFISRCDIR) -I$(SPLASHSRCDIR) -I$(srcdir) -I/usr/X11R6/include
+CXXFLAGS += -DHAVE_CONFIG_H -DHAVE_DIRENT_H=1 -I.. -DHAVE_REWINDDIR=1 -DHAVE_POPEN=1 -I.. -I$(GOOSRCDIR) -I$(XPDFSRCDIR) -I$(FOFISRCDIR) -I$(SPLASHSRCDIR) -I$(srcdir) -I/usr/X11R6/include
LDFLAGS =

View File

@ -1,13 +0,0 @@
--- xpdf/Gfx.cc.orig Wed Jun 25 00:41:27 2003
+++ xpdf/Gfx.cc Tue Jan 11 18:21:14 2005
@@ -2381,7 +2381,9 @@
haveMask = gFalse;
dict->lookup("Mask", &maskObj);
if (maskObj.isArray()) {
- for (i = 0; i < maskObj.arrayGetLength(); ++i) {
+ for (i = 0;
+ i < maskObj.arrayGetLength() && i < 2*gfxColorMaxComps;
+ ++i) {
maskObj.arrayGet(i, &obj1);
maskColors[i] = obj1.getInt();
obj1.free();

View File

@ -1,14 +0,0 @@
--- xpdf/GfxState.cc.orig Wed Jun 25 00:41:27 2003
+++ xpdf/GfxState.cc Tue Jan 11 18:21:14 2005
@@ -708,6 +708,11 @@
}
nCompsA = obj2.getInt();
obj2.free();
+ if (nCompsA > gfxColorMaxComps) {
+ error(-1, "ICCBased color space with too many (%d > %d) components",
+ nCompsA, gfxColorMaxComps);
+ nCompsA = gfxColorMaxComps;
+ }
if (dict->lookup("Alternate", &obj2)->isNull() ||
!(altA = GfxColorSpace::parse(&obj2))) {
switch (nCompsA) {