diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/02_permissions.dpatch b/02_permissions.dpatch new file mode 100644 index 0000000..fdd3978 --- /dev/null +++ b/02_permissions.dpatch @@ -0,0 +1,172 @@ +diff -up xpdf-3.04/xpdf/PDFCore.cc.permissions xpdf-3.04/xpdf/PDFCore.cc +--- xpdf-3.04/xpdf/PDFCore.cc.permissions 2014-05-28 14:50:50.000000000 -0400 ++++ xpdf-3.04/xpdf/PDFCore.cc 2014-05-29 15:42:47.290665898 -0400 +@@ -4,6 +4,8 @@ + // + // Copyright 2004-2013 Glyph & Cog, LLC + // ++// Modified for Debian by Hamish Moffatt, 18 August 2005. ++// + //======================================================================== + + #include +@@ -1677,9 +1679,11 @@ GString *PDFCore::extractText(int pg, do + int x0, y0, x1, y1, t; + GString *s; + ++#ifdef ENFORCE_PERMISSIONS + if (!doc->okToCopy()) { + return NULL; + } ++#endif + if ((page = findPage(pg))) { + cvtUserToDev(pg, xMin, yMin, &x0, &y0); + cvtUserToDev(pg, xMax, yMax, &x1, &y1); +diff -up xpdf-3.04/xpdf/pdfimages.cc.permissions xpdf-3.04/xpdf/pdfimages.cc +--- xpdf-3.04/xpdf/pdfimages.cc.permissions 2014-05-28 14:50:50.000000000 -0400 ++++ xpdf-3.04/xpdf/pdfimages.cc 2014-05-29 15:40:57.814449375 -0400 +@@ -4,6 +4,8 @@ + // + // Copyright 1998-2003 Glyph & Cog, LLC + // ++// Modified for Debian by Hamish Moffatt, 22 May 2002. ++// + //======================================================================== + + #include +@@ -119,12 +121,14 @@ int main(int argc, char *argv[]) { + } + + // check for copy permission ++#ifdef ENFORCE_PERMISSIONS + if (!doc->okToCopy()) { + error(errNotAllowed, -1, + "Copying of images from this document is not allowed."); + exitCode = 3; + goto err1; + } ++#endif + + // get page range + if (firstPage < 1) +diff -up xpdf-3.04/xpdf/pdftops.cc.permissions xpdf-3.04/xpdf/pdftops.cc +--- xpdf-3.04/xpdf/pdftops.cc.permissions 2014-05-28 14:50:50.000000000 -0400 ++++ xpdf-3.04/xpdf/pdftops.cc 2014-05-29 15:40:57.815449368 -0400 +@@ -4,6 +4,8 @@ + // + // Copyright 1996-2003 Glyph & Cog, LLC + // ++// Modified for Debian by Hamish Moffatt, 22 May 2002. ++// + //======================================================================== + + #include +@@ -300,12 +302,14 @@ int main(int argc, char *argv[]) { + goto err1; + } + ++#ifdef ENFORCE_PERMISSIONS + // check for print permission + if (!doc->okToPrint()) { + error(errNotAllowed, -1, "Printing this document is not allowed."); + exitCode = 3; + goto err1; + } ++#endif + + // construct PostScript file name + if (argc == 3) { +diff -up xpdf-3.04/xpdf/pdftotext.cc.permissions xpdf-3.04/xpdf/pdftotext.cc +--- xpdf-3.04/xpdf/pdftotext.cc.permissions 2014-05-28 14:50:50.000000000 -0400 ++++ xpdf-3.04/xpdf/pdftotext.cc 2014-05-29 15:43:37.923303455 -0400 +@@ -4,6 +4,8 @@ + // + // Copyright 1997-2013 Glyph & Cog, LLC + // ++// Modified for Debian by Hamish Moffatt, 22 May 2002. ++// + //======================================================================== + + #include +@@ -188,6 +190,7 @@ int main(int argc, char *argv[]) { + goto err2; + } + ++#ifdef ENFORCE_PERMISSIONS + // check for copy permission + if (!doc->okToCopy()) { + error(errNotAllowed, -1, +@@ -195,6 +198,7 @@ int main(int argc, char *argv[]) { + exitCode = 3; + goto err2; + } ++#endif + + // construct text file name + if (argc == 3) { +diff -up xpdf-3.04/xpdf/XPDFCore.cc.permissions xpdf-3.04/xpdf/XPDFCore.cc +--- xpdf-3.04/xpdf/XPDFCore.cc.permissions 2014-05-29 15:40:57.777449640 -0400 ++++ xpdf-3.04/xpdf/XPDFCore.cc 2014-05-29 15:40:57.819449339 -0400 +@@ -4,6 +4,8 @@ + // + // Copyright 2002-2003 Glyph & Cog, LLC + // ++// Modified for Debian by Hamish Moffatt, 22 May 2002. ++// + //======================================================================== + + #include +@@ -384,12 +386,16 @@ void XPDFCore::endSelection(int wx, int + #ifndef NO_TEXT_SELECT + if (selectULX != selectLRX && + selectULY != selectLRY) { ++#ifdef ENFORCE_PERMISSIONS + if (doc->okToCopy()) { + copySelection(); + } else { + error(errNotAllowed, -1, + "Copying of text from this document is not allowed."); + } ++#else ++ copySelection(); ++#endif + } + #endif + } +@@ -408,9 +414,11 @@ void XPDFCore::copySelection() { + int pg; + double ulx, uly, lrx, lry; + ++#ifdef ENFORCE_PERMISSIONS + if (!doc->okToCopy()) { + return; + } ++#endif + if (getSelection(&pg, &ulx, &uly, &lrx, &lry)) { + //~ for multithreading: need a mutex here + if (currentSelection) { +diff -up xpdf-3.04/xpdf/XPDFViewer.cc.permissions xpdf-3.04/xpdf/XPDFViewer.cc +--- xpdf-3.04/xpdf/XPDFViewer.cc.permissions 2014-05-29 15:40:57.808449418 -0400 ++++ xpdf-3.04/xpdf/XPDFViewer.cc 2014-05-29 15:40:57.821449325 -0400 +@@ -4,6 +4,8 @@ + // + // Copyright 2002-2003 Glyph & Cog, LLC + // ++// Modified for Debian by Hamish Moffatt, 22 May 2002. ++// + //======================================================================== + + #include +@@ -3503,10 +3505,12 @@ void XPDFViewer::printPrintCbk(Widget wi + PSOutputDev *psOut; + + doc = viewer->core->getDoc(); ++#ifdef ENFORCE_PERMISSIONS + if (!doc->okToPrint()) { + error(errNotAllowed, -1, "Printing this document is not allowed."); + return; + } ++#endif + + viewer->core->setBusyCursor(gTrue); + diff --git a/10_add_accelerators.dpatch b/10_add_accelerators.dpatch new file mode 100644 index 0000000..6cb0f05 --- /dev/null +++ b/10_add_accelerators.dpatch @@ -0,0 +1,33 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_add_accelerators.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Add keyboard accelerators for rotate (#385962) + +@DPATCH@ +diff -urNad xpdf-3.02~/xpdf/XPDFViewer.cc xpdf-3.02/xpdf/XPDFViewer.cc +--- xpdf-3.02~/xpdf/XPDFViewer.cc 2007-04-25 01:40:50.000000000 +1000 ++++ xpdf-3.02/xpdf/XPDFViewer.cc 2007-04-25 01:42:13.000000000 +1000 +@@ -1958,16 +1958,22 @@ + n = 0; + s = XmStringCreateLocalized("Rotate counterclockwise"); + XtSetArg(args[n], XmNlabelString, s); ++n; ++ s2 = XmStringCreateLocalized("["); ++ XtSetArg(args[n], XmNacceleratorText, s2); ++n; + btn = XmCreatePushButton(popupMenu, "rotateCCW", args, n); + XmStringFree(s); ++ XmStringFree(s2); + XtManageChild(btn); + XtAddCallback(btn, XmNactivateCallback, + &rotateCCWCbk, (XtPointer)this); + n = 0; + s = XmStringCreateLocalized("Rotate clockwise"); + XtSetArg(args[n], XmNlabelString, s); ++n; ++ s2 = XmStringCreateLocalized("]"); ++ XtSetArg(args[n], XmNacceleratorText, s2); ++n; + btn = XmCreatePushButton(popupMenu, "rotateCW", args, n); + XmStringFree(s); ++ XmStringFree(s2); + XtManageChild(btn); + XtAddCallback(btn, XmNactivateCallback, + &rotateCWCbk, (XtPointer)this); diff --git a/Makefile b/Makefile deleted file mode 100644 index d2c6be5..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: xpdf -# $Id$ -NAME := xpdf -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/fix-437725.dpatch b/fix-437725.dpatch new file mode 100644 index 0000000..cc61807 --- /dev/null +++ b/fix-437725.dpatch @@ -0,0 +1,42 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## fix-437725.dpatch from Arno Renevier +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fix segmentation fault when pressing Ctrl-W in full screen mode + +@DPATCH@ +--- a/xpdf/XPDFViewer.cc 2007-08-13 22:41:36.000000000 +0200 ++++ b/xpdf/XPDFViewer.cc 2007-08-13 23:01:07.000000000 +0200 +@@ -400,18 +400,21 @@ void XPDFViewer::clear() { + title = app->getTitle() ? app->getTitle()->getCString() + : (char *)xpdfAppName; + XtVaSetValues(win, XmNtitle, title, XmNiconName, title, NULL); +- s = XmStringCreateLocalized(""); +- XtVaSetValues(pageNumText, XmNlabelString, s, NULL); +- XmStringFree(s); +- s = XmStringCreateLocalized(" of 0"); +- XtVaSetValues(pageCountLabel, XmNlabelString, s, NULL); +- XmStringFree(s); + +- // disable buttons +- XtVaSetValues(prevTenPageBtn, XmNsensitive, False, NULL); +- XtVaSetValues(prevPageBtn, XmNsensitive, False, NULL); +- XtVaSetValues(nextTenPageBtn, XmNsensitive, False, NULL); +- XtVaSetValues(nextPageBtn, XmNsensitive, False, NULL); ++ if (toolBar != None) { ++ s = XmStringCreateLocalized(""); ++ XtVaSetValues(pageNumText, XmNlabelString, s, NULL); ++ XmStringFree(s); ++ s = XmStringCreateLocalized(" of 0"); ++ XtVaSetValues(pageCountLabel, XmNlabelString, s, NULL); ++ XmStringFree(s); ++ ++ // disable buttons ++ XtVaSetValues(prevTenPageBtn, XmNsensitive, False, NULL); ++ XtVaSetValues(prevPageBtn, XmNsensitive, False, NULL); ++ XtVaSetValues(nextTenPageBtn, XmNsensitive, False, NULL); ++ XtVaSetValues(nextPageBtn, XmNsensitive, False, NULL); ++ } + + // remove the old outline + #ifndef DISABLE_OUTLINE diff --git a/fix-444648.dpatch b/fix-444648.dpatch new file mode 100644 index 0000000..f69b843 --- /dev/null +++ b/fix-444648.dpatch @@ -0,0 +1,18 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## fix-444648.dpatch by Bernhard R. Link +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Do proper PS stream encoding on 64 bit architectures + +@DPATCH@ +--- xpdf-3.02/xpdf/Stream.cc.BAD 2008-12-10 12:16:16.000000000 -0500 ++++ xpdf-3.02/xpdf/Stream.cc 2008-12-10 12:16:21.000000000 -0500 +@@ -4514,7 +4514,7 @@ void ASCII85Encoder::reset() { + GBool ASCII85Encoder::fillBuf() { + Guint t; + char buf1[5]; +- int c0, c1, c2, c3; ++ unsigned int c0, c1, c2, c3; + int n, i; + + if (eof) { diff --git a/fix-462544.dpatch b/fix-462544.dpatch new file mode 100644 index 0000000..1b257d1 --- /dev/null +++ b/fix-462544.dpatch @@ -0,0 +1,28 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## fix-462544.dpatch from Jiri Palecek +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fix segmentation fault in image handling + +@DPATCH@ +--- xpdf-3.02/xpdf/SplashOutputDev.cc 2007-02-27 23:05:52.000000000 +0100 ++++ xpdf-3.02.new/xpdf/SplashOutputDev.cc 2008-02-17 17:28:46.000000000 +0100 +@@ -2475,14 +2461,14 @@ + tx = (int)floor(xMin); + if (tx < 0) { + tx = 0; +- } else if (tx > bitmap->getWidth()) { +- tx = bitmap->getWidth(); ++ } else if (tx >= bitmap->getWidth()) { ++ tx = bitmap->getWidth()-1; + } + ty = (int)floor(yMin); + if (ty < 0) { + ty = 0; +- } else if (ty > bitmap->getHeight()) { +- ty = bitmap->getHeight(); ++ } else if (ty >= bitmap->getHeight()) { ++ ty = bitmap->getHeight()-1; + } + w = (int)ceil(xMax) - tx + 1; + if (tx + w > bitmap->getWidth()) { diff --git a/fix-479467.dpatch b/fix-479467.dpatch new file mode 100644 index 0000000..cf2cb3b --- /dev/null +++ b/fix-479467.dpatch @@ -0,0 +1,20 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## fix-479467.dpatch from Stephan Beyer +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fix segmentation fault when pressing g in full screen mode + +@DPATCH@ +diff -ruN xpdf-3.02.old/xpdf/XPDFViewer.cc xpdf-3.02.fix/xpdf/XPDFViewer.cc +--- xpdf-3.02.old/xpdf/XPDFViewer.cc 2007-02-27 23:05:52.000000000 +0100 ++++ xpdf-3.02.fix/xpdf/XPDFViewer.cc 2008-05-04 21:29:34.000000000 +0200 +@@ -834,6 +834,9 @@ + + void XPDFViewer::cmdFocusToPageNum(GString *args[], int nArgs, + XEvent *event) { ++ if (core->getFullScreen()) { ++ return; ++ } + XmTextFieldSetSelection(pageNumText, 0, + strlen(XmTextFieldGetString(pageNumText)), + XtLastTimestampProcessed(display)); diff --git a/sources b/sources index 07e1e95..75f71be 100644 --- a/sources +++ b/sources @@ -1,7 +1,12 @@ -e53ec72546bb1a010fc2a2730f6d80f5 xpdf-3.01-novms.tar.gz -ba4b037ab691f8b029ec2b9820a2fb8c xpdf-chinese-simplified-2004-jul-27-NOCMAP.tar.gz -697e7edc09a285115b597ab03f2eddf9 xpdf-chinese-traditional-2004-jul-27-NOCMAP.tar.gz -7b22f31289ce0812d2ec77014e7b0cdf xpdf-cyrillic-2003-jun-28.tar.gz -f759b1b9624c7364e5d5a1ab3d146597 xpdf-japanese-2004-jul-27-NOCMAP.tar.gz -276624cddd1b70c29a3ae03ddb20fb3a xpdf-korean-2005-jul-07-NOCMAP.tar.gz -96e058c1b0429ae1ba0b50f1784b0985 xpdf-thai-2002-jan-16.tar.gz +3bc86c69c8ff444db52461270bef3f44 xpdf-3.04.tar.gz +ae8cdd4759295e02988506e7a570d00c xpdf-arabic-2011-aug-15.tar.gz +abd221d2df88de2011daad8d184dd66b xpdf-chinese-simplified-2011-sep-02-NOCMAP.tar.gz +63431231acd6d8f75e23bb3205793ff3 xpdf-chinese-traditional-2011-sep-02-NOCMAP.tar.gz +ea8ed8fd0ed26b8448e6558827249999 xpdf-cyrillic-2011-aug-15.tar.gz +2e988edf0c57def63717ee14bd6d30dd xpdf-greek-2011-aug-15.tar.gz +e1cb33f22bb71fb01998e5c59f538472 xpdf-hebrew-2011-aug-15.tar.gz +4033838d6bca641d5d2e76c7d1240c3e xpdf-japanese-2011-sep-02-NOCMAP.tar.gz +b9390fe8dc484d9d6ed78359fa520c33 xpdf-korean-2011-sep-02-NOCMAP.tar.gz +c135fe93f933edaa0f042a8d3cc9f799 xpdf-latin2-2011-aug-15.tar.gz +57fc888436f19cdf4a68ef17c17b86b7 xpdf-thai-2011-aug-15.tar.gz +640615c24581b26c4083210bef3013bf xpdf-turkish-2011-aug-15.tar.gz diff --git a/xpdf-3.00-64bit.patch b/xpdf-3.00-64bit.patch index ec13b7b..a9a4d43 100644 --- a/xpdf-3.00-64bit.patch +++ b/xpdf-3.00-64bit.patch @@ -1,55 +1,57 @@ ---- xpdf-3.00/goo/gmem.h.me 2005-07-25 10:47:46.000000000 +0200 -+++ xpdf-3.00/goo/gmem.h 2005-07-25 10:49:55.000000000 +0200 -@@ -19,13 +19,13 @@ - * Same as malloc, but prints error message and exits if malloc() - * returns NULL. - */ --extern void *gmalloc(int size); -+extern void *gmalloc(size_t size); - - /* - * Same as realloc, but prints error message and exits if realloc() - * returns NULL. If

is NULL, calls malloc instead of realloc(). - */ --extern void *grealloc(void *p, int size); -+extern void *grealloc(void *p, size_t size); - - /* - * Same as free, but checks for and ignores NULL pointers. ---- xpdf-3.00/goo/gmem.c.me 2005-07-25 10:47:51.000000000 +0200 -+++ xpdf-3.00/goo/gmem.c 2005-07-25 10:49:30.000000000 +0200 -@@ -53,9 +53,9 @@ +diff -up xpdf-3.02/goo/gmem.cc.BAD xpdf-3.02/goo/gmem.cc +--- xpdf-3.02/goo/gmem.cc.BAD 2007-08-01 17:20:00.000000000 -0500 ++++ xpdf-3.02/goo/gmem.cc 2007-08-01 17:22:04.000000000 -0500 +@@ -47,9 +47,9 @@ static int gMemInUse = 0; #endif /* DEBUG_MEM */ --void *gmalloc(int size) { -+void *gmalloc(size_t size) { +-void *gmalloc(int size) GMEM_EXCEP { ++void *gmalloc(size_t size) GMEM_EXCEP { #ifdef DEBUG_MEM - int size1; + size_t size1; char *mem; GMemHdr *hdr; void *data; -@@ -94,11 +94,11 @@ +@@ -106,11 +106,11 @@ void *gmalloc(int size) GMEM_EXCEP { #endif } --void *grealloc(void *p, int size) { -+void *grealloc(void *p, size_t size) { +-void *grealloc(void *p, int size) GMEM_EXCEP { ++void *grealloc(void *p, size_t size) GMEM_EXCEP { #ifdef DEBUG_MEM GMemHdr *hdr; void *q; - int oldSize; + size_t oldSize; - if (size == 0) { - if (p) -@@ -137,7 +137,7 @@ + if (size <= 0) { + if (p) { +@@ -195,7 +195,7 @@ void *greallocn(void *p, int nObjs, int void gfree(void *p) { #ifdef DEBUG_MEM - int size; + size_t size; GMemHdr *hdr; - GMemHdr *prevHdr, *q; - int lst; + unsigned long *trl, *clr; + +diff -up xpdf-3.02/goo/gmem.h.BAD xpdf-3.02/goo/gmem.h +--- xpdf-3.02/goo/gmem.h.BAD 2007-08-01 17:23:11.000000000 -0500 ++++ xpdf-3.02/goo/gmem.h 2007-08-01 17:23:45.000000000 -0500 +@@ -36,13 +36,13 @@ extern "C" { + * Same as malloc, but prints error message and exits if malloc() + * returns NULL. + */ +-extern void *gmalloc(int size) GMEM_EXCEP; ++extern void *gmalloc(size_t size) GMEM_EXCEP; + + /* + * Same as realloc, but prints error message and exits if realloc() + * returns NULL. If

is NULL, calls malloc instead of realloc(). + */ +-extern void *grealloc(void *p, int size) GMEM_EXCEP; ++extern void *grealloc(void *p, size_t size) GMEM_EXCEP; + + /* + * These are similar to gmalloc and grealloc, but take an object count diff --git a/xpdf-3.01-redhat-new.patch b/xpdf-3.01-redhat-new.patch index 7aa0b6a..2a1e0ca 100644 --- a/xpdf-3.01-redhat-new.patch +++ b/xpdf-3.01-redhat-new.patch @@ -85,29 +85,6 @@ This is the default location for the system-wide configuration file. Depending on build options, it may be placed elsewhere. .TP ---- xpdf-3.01/doc/sample-xpdfrc.orig 2005-08-17 00:34:30.000000000 -0500 -+++ xpdf-3.01/doc/sample-xpdfrc 2006-09-25 12:54:53.000000000 -0500 -@@ -56,7 +56,7 @@ - - # Set the default PostScript file or command. - --#psFile "|lpr -Pmyprinter" -+psFile "|lpr" - - # Set the default PostScript paper size -- this can be letter, legal, - # A4, or A3. You can also specify a paper size as width and height -@@ -88,4 +88,11 @@ - # Set the command used to run a web browser when a URL hyperlink is - # clicked. - -+urlCommand "htmlview '%s'" - #urlCommand "netscape -remote 'openURL(%s)'" -+ -+# CJK -+include /etc/xpdf/add-to-xpdfrc.japanese -+include /etc/xpdf/add-to-xpdfrc.korean -+include /etc/xpdf/add-to-xpdfrc.chinese-simplified -+include /etc/xpdf/add-to-xpdfrc.chinese-traditional --- xpdf-3.01/doc/xpdf.1.orig 2005-08-17 00:34:30.000000000 -0500 +++ xpdf-3.01/doc/xpdf.1 2006-09-25 12:54:53.000000000 -0500 @@ -41,7 +41,7 @@ xpdf @@ -256,3 +233,26 @@ +nameToUnicode /usr/share/xpdf/cyrillic/Bulgarian.nameToUnicode +unicodeMap KOI8-R /usr/share/xpdf/cyrillic/KOI8-R.unicodeMap #----- end Cyrillic support package +--- xpdf-3.03/doc/sample-xpdfrc.orig 2011-08-15 17:08:53.000000000 -0400 ++++ xpdf-3.03/doc/sample-xpdfrc 2011-08-22 13:41:14.405172432 -0400 +@@ -56,7 +56,7 @@ + + # Set the default PostScript file or command. + +-#psFile "|lpr -Pmyprinter" ++psFile "|lpr" + + # Set the default PostScript paper size -- this can be letter, legal, + # A4, or A3. You can also specify a paper size as width and height +@@ -89,4 +89,10 @@ + # clicked. + + #launchCommand viewer-script +-#urlCommand "netscape -remote 'openURL(%s)'" ++urlCommand "xdg-open '%s'" ++ ++# CJK ++include /etc/xpdf/add-to-xpdfrc.japanese ++include /etc/xpdf/add-to-xpdfrc.korean ++include /etc/xpdf/add-to-xpdfrc.chinese-simplified ++include /etc/xpdf/add-to-xpdfrc.chinese-traditional diff --git a/xpdf-3.02-additionalzoom.patch b/xpdf-3.02-additionalzoom.patch new file mode 100644 index 0000000..4e27d21 --- /dev/null +++ b/xpdf-3.02-additionalzoom.patch @@ -0,0 +1,26 @@ +diff -up xpdf-3.02/xpdf/XPDFViewer.cc.BAD xpdf-3.02/xpdf/XPDFViewer.cc +--- xpdf-3.02/xpdf/XPDFViewer.cc.BAD 2007-08-28 14:44:09.000000000 -0400 ++++ xpdf-3.02/xpdf/XPDFViewer.cc 2007-08-28 14:44:47.000000000 -0400 +@@ -140,6 +140,8 @@ struct ZoomMenuInfo { + + static ZoomMenuInfo zoomMenuInfo[nZoomMenuItems] = { + { "400%", 400 }, ++ { "300%", 300 }, ++ { "250%", 250 }, + { "200%", 200 }, + { "150%", 150 }, + { "125%", 125 }, +diff -up xpdf-3.02/xpdf/Stream.cc.BAD xpdf-3.02/xpdf/Stream.cc +diff -up xpdf-3.02/xpdf/XPDFViewer.h.BAD xpdf-3.02/xpdf/XPDFViewer.h +diff -up xpdf-3.02/xpdf/XPDFViewer.h.BAD xpdf-3.02/xpdf/XPDFViewer.h +--- xpdf-3.02/xpdf/XPDFViewer.h.BAD 2007-08-28 16:46:48.000000000 -0400 ++++ xpdf-3.02/xpdf/XPDFViewer.h 2007-08-28 16:46:57.000000000 -0400 +@@ -41,7 +41,7 @@ class XPDFViewer; + //------------------------------------------------------------------------ + + // NB: this must match the defn of zoomMenuBtnInfo in XPDFViewer.cc +-#define nZoomMenuItems 10 ++#define nZoomMenuItems 12 + + //------------------------------------------------------------------------ + diff --git a/xpdf-3.02-crash.patch b/xpdf-3.02-crash.patch new file mode 100644 index 0000000..8832eff --- /dev/null +++ b/xpdf-3.02-crash.patch @@ -0,0 +1,48 @@ +diff -up xpdf-3.02/fofi/FoFiType1.cc.crash xpdf-3.02/fofi/FoFiType1.cc +--- xpdf-3.02/fofi/FoFiType1.cc.crash 2007-02-27 17:05:51.000000000 -0500 ++++ xpdf-3.02/fofi/FoFiType1.cc 2009-02-11 11:31:04.000000000 -0500 +@@ -235,9 +235,14 @@ void FoFiType1::parse() { + } + } + } else { +- if (strtok(buf, " \t") && +- (p = strtok(NULL, " \t\n\r")) && !strcmp(p, "def")) { +- break; ++ p = strtok(buf, " \t\n\r"); ++ if (p) ++ { ++ if (!strcmp(p, "def")) break; ++ if (!strcmp(p, "readonly")) break; ++ // the spec does not says this but i'm mantaining old xpdf behaviour that accepts "foo def" as end of the encoding array ++ p = strtok(buf, " \t\n\r"); ++ if (p && !strcmp(p, "def")) break; + } + } + } +diff -up xpdf-3.02/splash/Splash.cc.crash xpdf-3.02/splash/Splash.cc +--- xpdf-3.02/splash/Splash.cc.crash 2007-02-27 17:05:52.000000000 -0500 ++++ xpdf-3.02/splash/Splash.cc 2009-02-11 11:34:45.000000000 -0500 +@@ -1501,6 +1501,11 @@ SplashError Splash::fillWithPattern(Spla + xPath->aaScale(); + } + xPath->sort(); ++ if (!&xPath->segs[0]) ++ { ++ delete xPath; ++ return splashErrEmptyPath; ++ } + scanner = new SplashXPathScanner(xPath, eo); + + // get the min and max x and y values +@@ -1573,6 +1578,11 @@ SplashError Splash::xorFill(SplashPath * + } + xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue); + xPath->sort(); ++ if (!&xPath->segs[0]) ++ { ++ delete xPath; ++ return splashErrEmptyPath; ++ } + scanner = new SplashXPathScanner(xPath, eo); + + // get the min and max x and y values diff --git a/xpdf-3.02-fontlist.patch b/xpdf-3.02-fontlist.patch new file mode 100644 index 0000000..c367b91 --- /dev/null +++ b/xpdf-3.02-fontlist.patch @@ -0,0 +1,32 @@ +--- xpdf-3.02/xpdf/XPDFApp.cc.fntlist 2007-02-27 15:05:52.000000000 -0700 ++++ xpdf-3.02/xpdf/XPDFApp.cc 2007-08-02 20:39:26.000000000 -0600 +@@ -35,9 +35,9 @@ + //------------------------------------------------------------------------ + + static String fallbackResources[] = { +- "*.zoomComboBox*fontList: -*-helvetica-medium-r-normal--12-*-*-*-*-*-iso8859-1", +- "*XmTextField.fontList: -*-courier-medium-r-normal--12-*-*-*-*-*-iso8859-1", +- "*.fontList: -*-helvetica-medium-r-normal--12-*-*-*-*-*-iso8859-1", ++ "*.zoomComboBox*fontList: -*-helvetica-medium-r-normal-*-12-*-*-*-*-*-iso8859-1", ++ "*XmTextField.fontList: -*-courier-medium-r-*-12-*-*-*-*-*-iso8859-1", ++ "*.fontList: -*-helvetica-medium-r-normal-*-12-*-*-*-*-*-iso8859-1", + "*XmTextField.translations: #override\\n" + " Ctrla:beginning-of-line()\\n" + " Ctrlb:backward-character()\\n" +--- xpdf-3.02/xpdf/XPDFViewer.cc.fntlist 2007-08-02 20:25:21.000000000 -0600 ++++ xpdf-3.02/xpdf/XPDFViewer.cc 2007-08-02 20:38:03.000000000 -0600 +@@ -2789,11 +2789,11 @@ void XPDFViewer::initAboutDialog() { + + //----- fonts + aboutBigFont = +- createFontList("-*-times-bold-i-normal--20-*-*-*-*-*-iso8859-1"); ++ createFontList("-*-times-bold-i-normal-*-20-*-*-*-*-*-iso8859-1"); + aboutVersionFont = +- createFontList("-*-times-medium-r-normal--14-*-*-*-*-*-iso8859-1"); ++ createFontList("-*-times-medium-r-normal-*-14-*-*-*-*-*-iso8859-1"); + aboutFixedFont = +- createFontList("-*-courier-medium-r-normal--12-*-*-*-*-*-iso8859-1"); ++ createFontList("-*-courier-medium-r-*-12-*-*-*-*-*-iso8859-1"); + + //----- heading + n = 0; diff --git a/xpdf-3.02-mousebuttons.patch b/xpdf-3.02-mousebuttons.patch new file mode 100644 index 0000000..eb0b395 --- /dev/null +++ b/xpdf-3.02-mousebuttons.patch @@ -0,0 +1,51 @@ +diff -up xpdf-3.02/xpdf/GlobalParams.cc.BAD xpdf-3.02/xpdf/GlobalParams.cc +--- xpdf-3.02/xpdf/GlobalParams.cc.BAD 2007-08-28 14:30:13.000000000 -0400 ++++ xpdf-3.02/xpdf/GlobalParams.cc 2007-08-28 14:30:38.000000000 -0400 +@@ -1574,10 +1574,10 @@ GBool GlobalParams::parseKey(GString *mo + !p0[3]) { + *code = xpdfKeyCodeF1 + 10 * (p0[1] - '0') + (p0[2] - '0') - 1; + } else if (!strncmp(p0, "mousePress", 10) && +- p0[10] >= '1' && p0[10] <= '7' && !p0[11]) { ++ p0[10] >= '1' && p0[10] <= '9' && !p0[11]) { + *code = xpdfKeyCodeMousePress1 + (p0[10] - '1'); + } else if (!strncmp(p0, "mouseRelease", 12) && +- p0[12] >= '1' && p0[12] <= '7' && !p0[13]) { ++ p0[12] >= '1' && p0[12] <= '9' && !p0[13]) { + *code = xpdfKeyCodeMouseRelease1 + (p0[12] - '1'); + } else if (*p0 >= 0x20 && *p0 <= 0x7e && !p0[1]) { + *code = (int)*p0; +diff -up xpdf-3.02/xpdf/GlobalParams.h.BAD xpdf-3.02/xpdf/GlobalParams.h +--- xpdf-3.02/xpdf/GlobalParams.h.BAD 2007-08-28 14:30:44.000000000 -0400 ++++ xpdf-3.02/xpdf/GlobalParams.h 2007-08-28 14:31:12.000000000 -0400 +@@ -164,6 +164,8 @@ public: + #define xpdfKeyCodeMousePress5 0x2005 + #define xpdfKeyCodeMousePress6 0x2006 + #define xpdfKeyCodeMousePress7 0x2007 ++#define xpdfKeyCodeMousePress8 0x2008 ++#define xpdfKeyCodeMousePress9 0x2009 + #define xpdfKeyCodeMouseRelease1 0x2101 + #define xpdfKeyCodeMouseRelease2 0x2102 + #define xpdfKeyCodeMouseRelease3 0x2103 +@@ -171,6 +173,8 @@ public: + #define xpdfKeyCodeMouseRelease5 0x2105 + #define xpdfKeyCodeMouseRelease6 0x2106 + #define xpdfKeyCodeMouseRelease7 0x2107 ++#define xpdfKeyCodeMouseRelease8 0x2108 ++#define xpdfKeyCodeMouseRelease9 0x2109 + #define xpdfKeyModNone 0 + #define xpdfKeyModShift (1 << 0) + #define xpdfKeyModCtrl (1 << 1) +diff -up xpdf-3.02/doc/xpdfrc.5.BAD xpdf-3.02/doc/xpdfrc.5 +--- xpdf-3.02/doc/xpdfrc.5.BAD 2007-08-28 14:31:25.000000000 -0400 ++++ xpdf-3.02/doc/xpdfrc.5 2007-08-28 14:31:35.000000000 -0400 +@@ -483,8 +483,8 @@ can be a regular ASCII character, or any + pgdn + left / right / up / down (arrow keys) + f1 .. f35 (function keys) +- mousePress1 .. mousePress7 (mouse buttons) +- mouseRelease1 .. mouseRelease7 (mouse buttons) ++ mousePress1 .. mousePress9 (mouse buttons) ++ mouseRelease1 .. mouseRelease9 (mouse buttons) + + .fi + .I Context diff --git a/xpdf-3.02-mousebuttons_view.patch b/xpdf-3.02-mousebuttons_view.patch new file mode 100644 index 0000000..aa2ef78 --- /dev/null +++ b/xpdf-3.02-mousebuttons_view.patch @@ -0,0 +1,18 @@ +--- xpdf-3.02/xpdf/XPDFViewer.cc~ 2009-02-02 01:58:55.000000000 -0700 ++++ xpdf-3.02/xpdf/XPDFViewer.cc 2009-02-02 02:27:04.000000000 -0700 +@@ -592,13 +592,13 @@ void XPDFViewer::mouseCbk(void *data, XE + int i; + + if (event->type == ButtonPress) { +- if (event->xbutton.button >= 1 && event->xbutton.button <= 7) { ++ if (event->xbutton.button >= 1 && event->xbutton.button <= 9) { + keyCode = xpdfKeyCodeMousePress1 + event->xbutton.button - 1; + } else { + return; + } + } else if (event->type == ButtonRelease) { +- if (event->xbutton.button >= 1 && event->xbutton.button <= 7) { ++ if (event->xbutton.button >= 1 && event->xbutton.button <= 9) { + keyCode = xpdfKeyCodeMouseRelease1 + event->xbutton.button - 1; + } else { + return; diff --git a/xpdf-3.02-x86_64-fix.patch b/xpdf-3.02-x86_64-fix.patch new file mode 100644 index 0000000..fec31b6 --- /dev/null +++ b/xpdf-3.02-x86_64-fix.patch @@ -0,0 +1,12 @@ +diff -up xpdf-3.02/xpdf/Stream.cc.BAD xpdf-3.02/xpdf/Stream.cc +--- xpdf-3.02/xpdf/Stream.cc.BAD 2007-08-21 16:20:40.000000000 -0400 ++++ xpdf-3.02/xpdf/Stream.cc 2007-08-21 16:20:44.000000000 -0400 +@@ -4451,7 +4451,7 @@ void ASCII85Encoder::reset() { + } + + GBool ASCII85Encoder::fillBuf() { +- Gulong t; ++ Guint t; + char buf1[5]; + int c0, c1, c2, c3; + int n, i; diff --git a/xpdf-3.02pl1.patch b/xpdf-3.02pl1.patch new file mode 100644 index 0000000..cd42fb9 --- /dev/null +++ b/xpdf-3.02pl1.patch @@ -0,0 +1,33 @@ +*** xpdf-3.02.orig/xpdf/Stream.cc Tue Feb 27 14:05:52 2007 +--- xpdf-3.02/xpdf/Stream.cc Thu Jul 26 14:44:43 2007 +*************** +*** 410,424 **** + ok = gFalse; + + nVals = width * nComps; +- if (width <= 0 || nComps <= 0 || nBits <= 0 || +- nComps >= INT_MAX / nBits || +- width >= INT_MAX / nComps / nBits || +- nVals * nBits + 7 < 0) { +- return; +- } + pixBytes = (nComps * nBits + 7) >> 3; + rowBytes = ((nVals * nBits + 7) >> 3) + pixBytes; +! if (rowBytes <= 0) { + return; + } + predLine = (Guchar *)gmalloc(rowBytes); +--- 410,422 ---- + ok = gFalse; + + nVals = width * nComps; + pixBytes = (nComps * nBits + 7) >> 3; + rowBytes = ((nVals * nBits + 7) >> 3) + pixBytes; +! if (width <= 0 || nComps <= 0 || nBits <= 0 || +! nComps > gfxColorMaxComps || +! nBits > 16 || +! width >= INT_MAX / nComps || // check for overflow in nVals +! nVals >= (INT_MAX - 7) / nBits) { // check for overflow in rowBytes + return; + } + predLine = (Guchar *)gmalloc(rowBytes); diff --git a/xpdf-3.02pl2.patch b/xpdf-3.02pl2.patch new file mode 100644 index 0000000..ab9e3c6 --- /dev/null +++ b/xpdf-3.02pl2.patch @@ -0,0 +1,823 @@ +diff -c -r xpdf-3.02pl1.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc +*** xpdf-3.02pl1.orig/xpdf/Stream.cc Thu Oct 25 15:47:38 2007 +--- xpdf-3.02/xpdf/Stream.cc Thu Oct 25 15:48:19 2007 +*************** +*** 1243,1265 **** + columns = columnsA; + if (columns < 1) { + columns = 1; +! } +! if (columns + 4 <= 0) { +! columns = INT_MAX - 4; + } + rows = rowsA; + endOfBlock = endOfBlockA; + black = blackA; +! refLine = (short *)gmallocn(columns + 3, sizeof(short)); +! codingLine = (short *)gmallocn(columns + 2, sizeof(short)); + + eof = gFalse; + row = 0; + nextLine2D = encoding < 0; + inputBits = 0; +! codingLine[0] = 0; +! codingLine[1] = refLine[2] = columns; +! a0 = 1; + + buf = EOF; + } +--- 1243,1268 ---- + columns = columnsA; + if (columns < 1) { + columns = 1; +! } else if (columns > INT_MAX - 2) { +! columns = INT_MAX - 2; + } + rows = rowsA; + endOfBlock = endOfBlockA; + black = blackA; +! // 0 <= codingLine[0] < codingLine[1] < ... < codingLine[n] = columns +! // ---> max codingLine size = columns + 1 +! // refLine has one extra guard entry at the end +! // ---> max refLine size = columns + 2 +! codingLine = (int *)gmallocn(columns + 1, sizeof(int)); +! refLine = (int *)gmallocn(columns + 2, sizeof(int)); + + eof = gFalse; + row = 0; + nextLine2D = encoding < 0; + inputBits = 0; +! codingLine[0] = columns; +! a0i = 0; +! outputBits = 0; + + buf = EOF; + } +*************** +*** 1278,1286 **** + row = 0; + nextLine2D = encoding < 0; + inputBits = 0; +! codingLine[0] = 0; +! codingLine[1] = columns; +! a0 = 1; + buf = EOF; + + // skip any initial zero bits and end-of-line marker, and get the 2D +--- 1281,1289 ---- + row = 0; + nextLine2D = encoding < 0; + inputBits = 0; +! codingLine[0] = columns; +! a0i = 0; +! outputBits = 0; + buf = EOF; + + // skip any initial zero bits and end-of-line marker, and get the 2D +*************** +*** 1297,1507 **** + } + } + + int CCITTFaxStream::lookChar() { + short code1, code2, code3; +! int a0New; +! GBool err, gotEOL; +! int ret; +! int bits, i; + +! // if at eof just return EOF +! if (eof && codingLine[a0] >= columns) { +! return EOF; + } + + // read the next row +! err = gFalse; +! if (codingLine[a0] >= columns) { + + // 2-D encoding + if (nextLine2D) { +- // state: +- // a0New = current position in coding line (0 <= a0New <= columns) +- // codingLine[a0] = last change in coding line +- // (black-to-white if a0 is even, +- // white-to-black if a0 is odd) +- // refLine[b1] = next change in reference line of opposite color +- // to a0 +- // invariants: +- // 0 <= codingLine[a0] <= a0New +- // <= refLine[b1] <= refLine[b1+1] <= columns +- // 0 <= a0 <= columns+1 +- // refLine[0] = 0 +- // refLine[n] = refLine[n+1] = columns +- // -- for some 1 <= n <= columns+1 +- // end condition: +- // 0 = codingLine[0] <= codingLine[1] < codingLine[2] < ... +- // < codingLine[n-1] < codingLine[n] = columns +- // -- where 1 <= n <= columns+1 + for (i = 0; codingLine[i] < columns; ++i) { + refLine[i] = codingLine[i]; + } +! refLine[i] = refLine[i + 1] = columns; +! b1 = 1; +! a0New = codingLine[a0 = 0] = 0; +! do { + code1 = getTwoDimCode(); + switch (code1) { + case twoDimPass: +! if (refLine[b1] < columns) { +! a0New = refLine[b1 + 1]; +! b1 += 2; + } + break; + case twoDimHoriz: +! if ((a0 & 1) == 0) { +! code1 = code2 = 0; + do { +! code1 += code3 = getWhiteCode(); + } while (code3 >= 64); + do { +! code2 += code3 = getBlackCode(); + } while (code3 >= 64); + } else { +- code1 = code2 = 0; + do { +! code1 += code3 = getBlackCode(); + } while (code3 >= 64); + do { +! code2 += code3 = getWhiteCode(); + } while (code3 >= 64); + } +! if (code1 > 0 || code2 > 0) { +! if (a0New + code1 <= columns) { +! codingLine[a0 + 1] = a0New + code1; +! } else { +! codingLine[a0 + 1] = columns; +! } +! ++a0; +! if (codingLine[a0] + code2 <= columns) { +! codingLine[a0 + 1] = codingLine[a0] + code2; +! } else { +! codingLine[a0 + 1] = columns; +! } +! ++a0; +! a0New = codingLine[a0]; +! while (refLine[b1] <= a0New && refLine[b1] < columns) { +! b1 += 2; + } + } + break; +! case twoDimVert0: +! if (refLine[b1] < columns) { +! a0New = codingLine[++a0] = refLine[b1]; +! ++b1; +! while (refLine[b1] <= a0New && refLine[b1] < columns) { +! b1 += 2; + } +- } else { +- a0New = codingLine[++a0] = columns; + } + break; + case twoDimVertR1: +! if (refLine[b1] + 1 < columns) { +! a0New = codingLine[++a0] = refLine[b1] + 1; +! ++b1; +! while (refLine[b1] <= a0New && refLine[b1] < columns) { +! b1 += 2; + } +- } else { +- a0New = codingLine[++a0] = columns; + } + break; +! case twoDimVertL1: +! if (refLine[b1] - 1 > a0New || (a0 == 0 && refLine[b1] == 1)) { +! a0New = codingLine[++a0] = refLine[b1] - 1; +! --b1; +! while (refLine[b1] <= a0New && refLine[b1] < columns) { +! b1 += 2; + } + } + break; +! case twoDimVertR2: +! if (refLine[b1] + 2 < columns) { +! a0New = codingLine[++a0] = refLine[b1] + 2; +! ++b1; +! while (refLine[b1] <= a0New && refLine[b1] < columns) { +! b1 += 2; + } +- } else { +- a0New = codingLine[++a0] = columns; + } + break; + case twoDimVertL2: +! if (refLine[b1] - 2 > a0New || (a0 == 0 && refLine[b1] == 2)) { +! a0New = codingLine[++a0] = refLine[b1] - 2; +! --b1; +! while (refLine[b1] <= a0New && refLine[b1] < columns) { +! b1 += 2; + } +! } +! break; +! case twoDimVertR3: +! if (refLine[b1] + 3 < columns) { +! a0New = codingLine[++a0] = refLine[b1] + 3; +! ++b1; +! while (refLine[b1] <= a0New && refLine[b1] < columns) { +! b1 += 2; + } +- } else { +- a0New = codingLine[++a0] = columns; + } + break; +! case twoDimVertL3: +! if (refLine[b1] - 3 > a0New || (a0 == 0 && refLine[b1] == 3)) { +! a0New = codingLine[++a0] = refLine[b1] - 3; +! --b1; +! while (refLine[b1] <= a0New && refLine[b1] < columns) { +! b1 += 2; + } + } + break; + case EOF: + eof = gTrue; +! codingLine[a0 = 0] = columns; +! return EOF; + default: + error(getPos(), "Bad 2D code %04x in CCITTFax stream", code1); + err = gTrue; + break; + } +! } while (codingLine[a0] < columns); + + // 1-D encoding + } else { +! codingLine[a0 = 0] = 0; +! while (1) { + code1 = 0; +! do { +! code1 += code3 = getWhiteCode(); +! } while (code3 >= 64); +! codingLine[a0+1] = codingLine[a0] + code1; +! ++a0; +! if (codingLine[a0] >= columns) { +! break; +! } +! code2 = 0; +! do { +! code2 += code3 = getBlackCode(); +! } while (code3 >= 64); +! codingLine[a0+1] = codingLine[a0] + code2; +! ++a0; +! if (codingLine[a0] >= columns) { +! break; + } + } + } + +- if (codingLine[a0] != columns) { +- error(getPos(), "CCITTFax row is wrong length (%d)", codingLine[a0]); +- // force the row to be the correct length +- while (codingLine[a0] > columns) { +- --a0; +- } +- codingLine[++a0] = columns; +- err = gTrue; +- } +- + // byte-align the row + if (byteAlign) { + inputBits &= ~7; +--- 1300,1529 ---- + } + } + ++ inline void CCITTFaxStream::addPixels(int a1, int blackPixels) { ++ if (a1 > codingLine[a0i]) { ++ if (a1 > columns) { ++ error(getPos(), "CCITTFax row is wrong length (%d)", a1); ++ err = gTrue; ++ a1 = columns; ++ } ++ if ((a0i & 1) ^ blackPixels) { ++ ++a0i; ++ } ++ codingLine[a0i] = a1; ++ } ++ } ++ ++ inline void CCITTFaxStream::addPixelsNeg(int a1, int blackPixels) { ++ if (a1 > codingLine[a0i]) { ++ if (a1 > columns) { ++ error(getPos(), "CCITTFax row is wrong length (%d)", a1); ++ err = gTrue; ++ a1 = columns; ++ } ++ if ((a0i & 1) ^ blackPixels) { ++ ++a0i; ++ } ++ codingLine[a0i] = a1; ++ } else if (a1 < codingLine[a0i]) { ++ if (a1 < 0) { ++ error(getPos(), "Invalid CCITTFax code"); ++ err = gTrue; ++ a1 = 0; ++ } ++ while (a0i > 0 && a1 <= codingLine[a0i - 1]) { ++ --a0i; ++ } ++ codingLine[a0i] = a1; ++ } ++ } ++ + int CCITTFaxStream::lookChar() { + short code1, code2, code3; +! int b1i, blackPixels, i, bits; +! GBool gotEOL; + +! if (buf != EOF) { +! return buf; + } + + // read the next row +! if (outputBits == 0) { +! +! // if at eof just return EOF +! if (eof) { +! return EOF; +! } +! +! err = gFalse; + + // 2-D encoding + if (nextLine2D) { + for (i = 0; codingLine[i] < columns; ++i) { + refLine[i] = codingLine[i]; + } +! refLine[i++] = columns; +! refLine[i] = columns; +! codingLine[0] = 0; +! a0i = 0; +! b1i = 0; +! blackPixels = 0; +! // invariant: +! // refLine[b1i-1] <= codingLine[a0i] < refLine[b1i] < refLine[b1i+1] +! // <= columns +! // exception at left edge: +! // codingLine[a0i = 0] = refLine[b1i = 0] = 0 is possible +! // exception at right edge: +! // refLine[b1i] = refLine[b1i+1] = columns is possible +! while (codingLine[a0i] < columns) { + code1 = getTwoDimCode(); + switch (code1) { + case twoDimPass: +! addPixels(refLine[b1i + 1], blackPixels); +! if (refLine[b1i + 1] < columns) { +! b1i += 2; + } + break; + case twoDimHoriz: +! code1 = code2 = 0; +! if (blackPixels) { + do { +! code1 += code3 = getBlackCode(); + } while (code3 >= 64); + do { +! code2 += code3 = getWhiteCode(); + } while (code3 >= 64); + } else { + do { +! code1 += code3 = getWhiteCode(); + } while (code3 >= 64); + do { +! code2 += code3 = getBlackCode(); + } while (code3 >= 64); + } +! addPixels(codingLine[a0i] + code1, blackPixels); +! if (codingLine[a0i] < columns) { +! addPixels(codingLine[a0i] + code2, blackPixels ^ 1); +! } +! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) { +! b1i += 2; +! } +! break; +! case twoDimVertR3: +! addPixels(refLine[b1i] + 3, blackPixels); +! blackPixels ^= 1; +! if (codingLine[a0i] < columns) { +! ++b1i; +! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) { +! b1i += 2; + } + } + break; +! case twoDimVertR2: +! addPixels(refLine[b1i] + 2, blackPixels); +! blackPixels ^= 1; +! if (codingLine[a0i] < columns) { +! ++b1i; +! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) { +! b1i += 2; + } + } + break; + case twoDimVertR1: +! addPixels(refLine[b1i] + 1, blackPixels); +! blackPixels ^= 1; +! if (codingLine[a0i] < columns) { +! ++b1i; +! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) { +! b1i += 2; + } + } + break; +! case twoDimVert0: +! addPixels(refLine[b1i], blackPixels); +! blackPixels ^= 1; +! if (codingLine[a0i] < columns) { +! ++b1i; +! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) { +! b1i += 2; + } + } + break; +! case twoDimVertL3: +! addPixelsNeg(refLine[b1i] - 3, blackPixels); +! blackPixels ^= 1; +! if (codingLine[a0i] < columns) { +! if (b1i > 0) { +! --b1i; +! } else { +! ++b1i; +! } +! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) { +! b1i += 2; + } + } + break; + case twoDimVertL2: +! addPixelsNeg(refLine[b1i] - 2, blackPixels); +! blackPixels ^= 1; +! if (codingLine[a0i] < columns) { +! if (b1i > 0) { +! --b1i; +! } else { +! ++b1i; + } +! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) { +! b1i += 2; + } + } + break; +! case twoDimVertL1: +! addPixelsNeg(refLine[b1i] - 1, blackPixels); +! blackPixels ^= 1; +! if (codingLine[a0i] < columns) { +! if (b1i > 0) { +! --b1i; +! } else { +! ++b1i; +! } +! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) { +! b1i += 2; + } + } + break; + case EOF: ++ addPixels(columns, 0); + eof = gTrue; +! break; + default: + error(getPos(), "Bad 2D code %04x in CCITTFax stream", code1); ++ addPixels(columns, 0); + err = gTrue; + break; + } +! } + + // 1-D encoding + } else { +! codingLine[0] = 0; +! a0i = 0; +! blackPixels = 0; +! while (codingLine[a0i] < columns) { + code1 = 0; +! if (blackPixels) { +! do { +! code1 += code3 = getBlackCode(); +! } while (code3 >= 64); +! } else { +! do { +! code1 += code3 = getWhiteCode(); +! } while (code3 >= 64); + } ++ addPixels(codingLine[a0i] + code1, blackPixels); ++ blackPixels ^= 1; + } + } + + // byte-align the row + if (byteAlign) { + inputBits &= ~7; +*************** +*** 1560,1573 **** + // this if we know the stream contains end-of-line markers because + // the "just plow on" technique tends to work better otherwise + } else if (err && endOfLine) { +! do { + if (code1 == EOF) { + eof = gTrue; + return EOF; + } + eatBits(1); +! code1 = lookBits(13); +! } while ((code1 >> 1) != 0x001); + eatBits(12); + if (encoding > 0) { + eatBits(1); +--- 1582,1598 ---- + // this if we know the stream contains end-of-line markers because + // the "just plow on" technique tends to work better otherwise + } else if (err && endOfLine) { +! while (1) { +! code1 = lookBits(13); + if (code1 == EOF) { + eof = gTrue; + return EOF; + } ++ if ((code1 >> 1) == 0x001) { ++ break; ++ } + eatBits(1); +! } + eatBits(12); + if (encoding > 0) { + eatBits(1); +*************** +*** 1575,1585 **** + } + } + +! a0 = 0; +! outputBits = codingLine[1] - codingLine[0]; +! if (outputBits == 0) { +! a0 = 1; +! outputBits = codingLine[2] - codingLine[1]; + } + + ++row; +--- 1600,1610 ---- + } + } + +! // set up for output +! if (codingLine[0] > 0) { +! outputBits = codingLine[a0i = 0]; +! } else { +! outputBits = codingLine[a0i = 1]; + } + + ++row; +*************** +*** 1587,1625 **** + + // get a byte + if (outputBits >= 8) { +! ret = ((a0 & 1) == 0) ? 0xff : 0x00; +! if ((outputBits -= 8) == 0) { +! ++a0; +! if (codingLine[a0] < columns) { +! outputBits = codingLine[a0 + 1] - codingLine[a0]; +! } + } + } else { + bits = 8; +! ret = 0; + do { + if (outputBits > bits) { +! i = bits; +! bits = 0; +! if ((a0 & 1) == 0) { +! ret |= 0xff >> (8 - i); + } +! outputBits -= i; + } else { +! i = outputBits; +! bits -= outputBits; +! if ((a0 & 1) == 0) { +! ret |= (0xff >> (8 - i)) << bits; + } + outputBits = 0; +! ++a0; +! if (codingLine[a0] < columns) { +! outputBits = codingLine[a0 + 1] - codingLine[a0]; + } + } +! } while (bits > 0 && codingLine[a0] < columns); + } +- buf = black ? (ret ^ 0xff) : ret; + return buf; + } + +--- 1612,1654 ---- + + // get a byte + if (outputBits >= 8) { +! buf = (a0i & 1) ? 0x00 : 0xff; +! outputBits -= 8; +! if (outputBits == 0 && codingLine[a0i] < columns) { +! ++a0i; +! outputBits = codingLine[a0i] - codingLine[a0i - 1]; + } + } else { + bits = 8; +! buf = 0; + do { + if (outputBits > bits) { +! buf <<= bits; +! if (!(a0i & 1)) { +! buf |= 0xff >> (8 - bits); + } +! outputBits -= bits; +! bits = 0; + } else { +! buf <<= outputBits; +! if (!(a0i & 1)) { +! buf |= 0xff >> (8 - outputBits); + } ++ bits -= outputBits; + outputBits = 0; +! if (codingLine[a0i] < columns) { +! ++a0i; +! outputBits = codingLine[a0i] - codingLine[a0i - 1]; +! } else if (bits > 0) { +! buf <<= bits; +! bits = 0; + } + } +! } while (bits); +! } +! if (black) { +! buf ^= 0xff; + } + return buf; + } + +*************** +*** 1661,1666 **** +--- 1690,1698 ---- + code = 0; // make gcc happy + if (endOfBlock) { + code = lookBits(12); ++ if (code == EOF) { ++ return 1; ++ } + if ((code >> 5) == 0) { + p = &whiteTab1[code]; + } else { +*************** +*** 1673,1678 **** +--- 1705,1713 ---- + } else { + for (n = 1; n <= 9; ++n) { + code = lookBits(n); ++ if (code == EOF) { ++ return 1; ++ } + if (n < 9) { + code <<= 9 - n; + } +*************** +*** 1684,1689 **** +--- 1719,1727 ---- + } + for (n = 11; n <= 12; ++n) { + code = lookBits(n); ++ if (code == EOF) { ++ return 1; ++ } + if (n < 12) { + code <<= 12 - n; + } +*************** +*** 1709,1717 **** + code = 0; // make gcc happy + if (endOfBlock) { + code = lookBits(13); + if ((code >> 7) == 0) { + p = &blackTab1[code]; +! } else if ((code >> 9) == 0) { + p = &blackTab2[(code >> 1) - 64]; + } else { + p = &blackTab3[code >> 7]; +--- 1747,1758 ---- + code = 0; // make gcc happy + if (endOfBlock) { + code = lookBits(13); ++ if (code == EOF) { ++ return 1; ++ } + if ((code >> 7) == 0) { + p = &blackTab1[code]; +! } else if ((code >> 9) == 0 && (code >> 7) != 0) { + p = &blackTab2[(code >> 1) - 64]; + } else { + p = &blackTab3[code >> 7]; +*************** +*** 1723,1728 **** +--- 1764,1772 ---- + } else { + for (n = 2; n <= 6; ++n) { + code = lookBits(n); ++ if (code == EOF) { ++ return 1; ++ } + if (n < 6) { + code <<= 6 - n; + } +*************** +*** 1734,1739 **** +--- 1778,1786 ---- + } + for (n = 7; n <= 12; ++n) { + code = lookBits(n); ++ if (code == EOF) { ++ return 1; ++ } + if (n < 12) { + code <<= 12 - n; + } +*************** +*** 1747,1752 **** +--- 1794,1802 ---- + } + for (n = 10; n <= 13; ++n) { + code = lookBits(n); ++ if (code == EOF) { ++ return 1; ++ } + if (n < 13) { + code <<= 13 - n; + } +*************** +*** 1961,1966 **** +--- 2011,2022 ---- + // allocate a buffer for the whole image + bufWidth = ((width + mcuWidth - 1) / mcuWidth) * mcuWidth; + bufHeight = ((height + mcuHeight - 1) / mcuHeight) * mcuHeight; ++ if (bufWidth <= 0 || bufHeight <= 0 || ++ bufWidth > INT_MAX / bufWidth / (int)sizeof(int)) { ++ error(getPos(), "Invalid image size in DCT stream"); ++ y = height; ++ return; ++ } + for (i = 0; i < numComps; ++i) { + frameBuf[i] = (int *)gmallocn(bufWidth * bufHeight, sizeof(int)); + memset(frameBuf[i], 0, bufWidth * bufHeight * sizeof(int)); +*************** +*** 3036,3041 **** +--- 3092,3102 ---- + } + scanInfo.firstCoeff = str->getChar(); + scanInfo.lastCoeff = str->getChar(); ++ if (scanInfo.firstCoeff < 0 || scanInfo.lastCoeff > 63 || ++ scanInfo.firstCoeff > scanInfo.lastCoeff) { ++ error(getPos(), "Bad DCT coefficient numbers in scan info block"); ++ return gFalse; ++ } + c = str->getChar(); + scanInfo.ah = (c >> 4) & 0x0f; + scanInfo.al = c & 0x0f; +diff -c -r xpdf-3.02pl1.orig/xpdf/Stream.h xpdf-3.02/xpdf/Stream.h +*** xpdf-3.02pl1.orig/xpdf/Stream.h Tue Feb 27 14:05:52 2007 +--- xpdf-3.02/xpdf/Stream.h Thu Oct 25 15:48:15 2007 +*************** +*** 528,540 **** + int row; // current row + int inputBuf; // input buffer + int inputBits; // number of bits in input buffer +! short *refLine; // reference line changing elements +! int b1; // index into refLine +! short *codingLine; // coding line changing elements +! int a0; // index into codingLine + int outputBits; // remaining ouput bits + int buf; // character buffer + + short getTwoDimCode(); + short getWhiteCode(); + short getBlackCode(); +--- 528,542 ---- + int row; // current row + int inputBuf; // input buffer + int inputBits; // number of bits in input buffer +! int *codingLine; // coding line changing elements +! int *refLine; // reference line changing elements +! int a0i; // index into codingLine +! GBool err; // error on current line + int outputBits; // remaining ouput bits + int buf; // character buffer + ++ void addPixels(int a1, int black); ++ void addPixelsNeg(int a1, int black); + short getTwoDimCode(); + short getWhiteCode(); + short getBlackCode(); diff --git a/xpdf-3.02pl3.patch b/xpdf-3.02pl3.patch new file mode 100644 index 0000000..0034993 --- /dev/null +++ b/xpdf-3.02pl3.patch @@ -0,0 +1,1145 @@ +diff -r -c xpdf-3.02.orig/goo/gmem.cc xpdf-3.02/goo/gmem.cc +*** xpdf-3.02.orig/goo/gmem.cc Tue Feb 27 14:05:51 2007 +--- xpdf-3.02/goo/gmem.cc Thu Mar 19 15:47:25 2009 +*************** +*** 55,61 **** + void *data; + unsigned long *trl, *p; + +! if (size <= 0) { + return NULL; + } + size1 = gMemDataSize(size); +--- 55,69 ---- + void *data; + unsigned long *trl, *p; + +! if (size < 0) { +! #if USE_EXCEPTIONS +! throw GMemException(); +! #else +! fprintf(stderr, "Invalid memory allocation size\n"); +! exit(1); +! #endif +! } +! if (size == 0) { + return NULL; + } + size1 = gMemDataSize(size); +*************** +*** 91,97 **** + #else + void *p; + +! if (size <= 0) { + return NULL; + } + if (!(p = malloc(size))) { +--- 99,113 ---- + #else + void *p; + +! if (size < 0) { +! #if USE_EXCEPTIONS +! throw GMemException(); +! #else +! fprintf(stderr, "Invalid memory allocation size\n"); +! exit(1); +! #endif +! } +! if (size == 0) { + return NULL; + } + if (!(p = malloc(size))) { +*************** +*** 112,118 **** + void *q; + size_t oldSize; + +! if (size <= 0) { + if (p) { + gfree(p); + } +--- 128,142 ---- + void *q; + size_t oldSize; + +! if (size < 0) { +! #if USE_EXCEPTIONS +! throw GMemException(); +! #else +! fprintf(stderr, "Invalid memory allocation size\n"); +! exit(1); +! #endif +! } +! if (size == 0) { + if (p) { + gfree(p); + } +*************** +*** 131,137 **** + #else + void *q; + +! if (size <= 0) { + if (p) { + free(p); + } +--- 155,169 ---- + #else + void *q; + +! if (size < 0) { +! #if USE_EXCEPTIONS +! throw GMemException(); +! #else +! fprintf(stderr, "Invalid memory allocation size\n"); +! exit(1); +! #endif +! } +! if (size == 0) { + if (p) { + free(p); + } +diff -r -c xpdf-3.02.orig/xpdf/JBIG2Stream.cc xpdf-3.02/xpdf/JBIG2Stream.cc +*** xpdf-3.02.orig/xpdf/JBIG2Stream.cc Tue Feb 27 14:05:52 2007 +--- xpdf-3.02/xpdf/JBIG2Stream.cc Tue Mar 31 10:55:23 2009 +*************** +*** 422,433 **** + table[i] = table[len]; + + // assign prefixes +! i = 0; +! prefix = 0; +! table[i++].prefix = prefix++; +! for (; table[i].rangeLen != jbig2HuffmanEOT; ++i) { +! prefix <<= table[i].prefixLen - table[i-1].prefixLen; +! table[i].prefix = prefix++; + } + } + +--- 422,435 ---- + table[i] = table[len]; + + // assign prefixes +! if (table[0].rangeLen != jbig2HuffmanEOT) { +! i = 0; +! prefix = 0; +! table[i++].prefix = prefix++; +! for (; table[i].rangeLen != jbig2HuffmanEOT; ++i) { +! prefix <<= table[i].prefixLen - table[i-1].prefixLen; +! table[i].prefix = prefix++; +! } + } + } + +*************** +*** 491,497 **** + } + if (p->bits < 0) { + error(str->getPos(), "Bad two dim code in JBIG2 MMR stream"); +! return 0; + } + bufLen -= p->bits; + return p->n; +--- 493,499 ---- + } + if (p->bits < 0) { + error(str->getPos(), "Bad two dim code in JBIG2 MMR stream"); +! return EOF; + } + bufLen -= p->bits; + return p->n; +*************** +*** 507,513 **** + ++nBytesRead; + } + while (1) { +! if (bufLen >= 7 && ((buf >> (bufLen - 7)) & 0x7f) == 0) { + if (bufLen <= 12) { + code = buf << (12 - bufLen); + } else { +--- 509,515 ---- + ++nBytesRead; + } + while (1) { +! if (bufLen >= 11 && ((buf >> (bufLen - 7)) & 0x7f) == 0) { + if (bufLen <= 12) { + code = buf << (12 - bufLen); + } else { +*************** +*** 550,563 **** + ++nBytesRead; + } + while (1) { +! if (bufLen >= 6 && ((buf >> (bufLen - 6)) & 0x3f) == 0) { + if (bufLen <= 13) { + code = buf << (13 - bufLen); + } else { + code = buf >> (bufLen - 13); + } + p = &blackTab1[code & 0x7f]; +! } else if (bufLen >= 4 && ((buf >> (bufLen - 4)) & 0x0f) == 0) { + if (bufLen <= 12) { + code = buf << (12 - bufLen); + } else { +--- 552,566 ---- + ++nBytesRead; + } + while (1) { +! if (bufLen >= 10 && ((buf >> (bufLen - 6)) & 0x3f) == 0) { + if (bufLen <= 13) { + code = buf << (13 - bufLen); + } else { + code = buf >> (bufLen - 13); + } + p = &blackTab1[code & 0x7f]; +! } else if (bufLen >= 7 && ((buf >> (bufLen - 4)) & 0x0f) == 0 && +! ((buf >> (bufLen - 6)) & 0x03) != 0) { + if (bufLen <= 12) { + code = buf << (12 - bufLen); + } else { +*************** +*** 683,690 **** + h = hA; + line = (wA + 7) >> 3; + if (w <= 0 || h <= 0 || line <= 0 || h >= (INT_MAX - 1) / line) { +! data = NULL; +! return; + } + // need to allocate one extra guard byte for use in combine() + data = (Guchar *)gmalloc(h * line + 1); +--- 686,694 ---- + h = hA; + line = (wA + 7) >> 3; + if (w <= 0 || h <= 0 || line <= 0 || h >= (INT_MAX - 1) / line) { +! // force a call to gmalloc(-1), which will throw an exception +! h = -1; +! line = 2; + } + // need to allocate one extra guard byte for use in combine() + data = (Guchar *)gmalloc(h * line + 1); +*************** +*** 698,705 **** + h = bitmap->h; + line = bitmap->line; + if (w <= 0 || h <= 0 || line <= 0 || h >= (INT_MAX - 1) / line) { +! data = NULL; +! return; + } + // need to allocate one extra guard byte for use in combine() + data = (Guchar *)gmalloc(h * line + 1); +--- 702,710 ---- + h = bitmap->h; + line = bitmap->line; + if (w <= 0 || h <= 0 || line <= 0 || h >= (INT_MAX - 1) / line) { +! // force a call to gmalloc(-1), which will throw an exception +! h = -1; +! line = 2; + } + // need to allocate one extra guard byte for use in combine() + data = (Guchar *)gmalloc(h * line + 1); +*************** +*** 754,759 **** +--- 759,766 ---- + inline void JBIG2Bitmap::getPixelPtr(int x, int y, JBIG2BitmapPtr *ptr) { + if (y < 0 || y >= h || x >= w) { + ptr->p = NULL; ++ ptr->shift = 0; // make gcc happy ++ ptr->x = 0; // make gcc happy + } else if (x < 0) { + ptr->p = &data[y * line]; + ptr->shift = 7; +*************** +*** 798,803 **** +--- 805,814 ---- + Guint src0, src1, src, dest, s1, s2, m1, m2, m3; + GBool oneByte; + ++ // check for the pathological case where y = -2^31 ++ if (y < -0x7fffffff) { ++ return; ++ } + if (y < 0) { + y0 = -y; + } else { +*************** +*** 1011,1018 **** +--- 1022,1034 ---- + JBIG2SymbolDict::JBIG2SymbolDict(Guint segNumA, Guint sizeA): + JBIG2Segment(segNumA) + { ++ Guint i; ++ + size = sizeA; + bitmaps = (JBIG2Bitmap **)gmallocn(size, sizeof(JBIG2Bitmap *)); ++ for (i = 0; i < size; ++i) { ++ bitmaps[i] = NULL; ++ } + genericRegionStats = NULL; + refinementRegionStats = NULL; + } +*************** +*** 1021,1027 **** + Guint i; + + for (i = 0; i < size; ++i) { +! delete bitmaps[i]; + } + gfree(bitmaps); + if (genericRegionStats) { +--- 1037,1045 ---- + Guint i; + + for (i = 0; i < size; ++i) { +! if (bitmaps[i]) { +! delete bitmaps[i]; +! } + } + gfree(bitmaps); + if (genericRegionStats) { +*************** +*** 1296,1301 **** +--- 1314,1326 ---- + goto eofError2; + } + ++ // check for missing page information segment ++ if (!pageBitmap && ((segType >= 4 && segType <= 7) || ++ (segType >= 20 && segType <= 43))) { ++ error(getPos(), "First JBIG2 segment associated with a page must be a page information segment"); ++ goto syntaxError; ++ } ++ + // read the segment data + switch (segType) { + case 0: +*************** +*** 1411,1416 **** +--- 1436,1443 ---- + Guint i, j, k; + Guchar *p; + ++ symWidths = NULL; ++ + // symbol dictionary flags + if (!readUWord(&flags)) { + goto eofError; +*************** +*** 1466,1485 **** + codeTables = new GList(); + numInputSyms = 0; + for (i = 0; i < nRefSegs; ++i) { +! seg = findSegment(refSegs[i]); +! if (seg->getType() == jbig2SegSymbolDict) { +! numInputSyms += ((JBIG2SymbolDict *)seg)->getSize(); +! } else if (seg->getType() == jbig2SegCodeTable) { +! codeTables->append(seg); + } + } + + // compute symbol code length +! symCodeLen = 0; +! i = 1; +! while (i < numInputSyms + numNewSyms) { + ++symCodeLen; +! i <<= 1; + } + + // get the input symbol bitmaps +--- 1493,1524 ---- + codeTables = new GList(); + numInputSyms = 0; + for (i = 0; i < nRefSegs; ++i) { +! if ((seg = findSegment(refSegs[i]))) { +! if (seg->getType() == jbig2SegSymbolDict) { +! j = ((JBIG2SymbolDict *)seg)->getSize(); +! if (numInputSyms > UINT_MAX - j) { +! error(getPos(), "Too many input symbols in JBIG2 symbol dictionary"); +! delete codeTables; +! goto eofError; +! } +! numInputSyms += j; +! } else if (seg->getType() == jbig2SegCodeTable) { +! codeTables->append(seg); +! } + } + } ++ if (numInputSyms > UINT_MAX - numNewSyms) { ++ error(getPos(), "Too many input symbols in JBIG2 symbol dictionary"); ++ delete codeTables; ++ goto eofError; ++ } + + // compute symbol code length +! symCodeLen = 1; +! i = (numInputSyms + numNewSyms) >> 1; +! while (i) { + ++symCodeLen; +! i >>= 1; + } + + // get the input symbol bitmaps +*************** +*** 1491,1501 **** + k = 0; + inputSymbolDict = NULL; + for (i = 0; i < nRefSegs; ++i) { +! seg = findSegment(refSegs[i]); +! if (seg->getType() == jbig2SegSymbolDict) { +! inputSymbolDict = (JBIG2SymbolDict *)seg; +! for (j = 0; j < inputSymbolDict->getSize(); ++j) { +! bitmaps[k++] = inputSymbolDict->getBitmap(j); + } + } + } +--- 1530,1541 ---- + k = 0; + inputSymbolDict = NULL; + for (i = 0; i < nRefSegs; ++i) { +! if ((seg = findSegment(refSegs[i]))) { +! if (seg->getType() == jbig2SegSymbolDict) { +! inputSymbolDict = (JBIG2SymbolDict *)seg; +! for (j = 0; j < inputSymbolDict->getSize(); ++j) { +! bitmaps[k++] = inputSymbolDict->getBitmap(j); +! } + } + } + } +*************** +*** 1510,1515 **** +--- 1550,1558 ---- + } else if (huffDH == 1) { + huffDHTable = huffTableE; + } else { ++ if (i >= (Guint)codeTables->getLength()) { ++ goto codeTableError; ++ } + huffDHTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable(); + } + if (huffDW == 0) { +*************** +*** 1517,1533 **** +--- 1560,1585 ---- + } else if (huffDW == 1) { + huffDWTable = huffTableC; + } else { ++ if (i >= (Guint)codeTables->getLength()) { ++ goto codeTableError; ++ } + huffDWTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable(); + } + if (huffBMSize == 0) { + huffBMSizeTable = huffTableA; + } else { ++ if (i >= (Guint)codeTables->getLength()) { ++ goto codeTableError; ++ } + huffBMSizeTable = + ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable(); + } + if (huffAggInst == 0) { + huffAggInstTable = huffTableA; + } else { ++ if (i >= (Guint)codeTables->getLength()) { ++ goto codeTableError; ++ } + huffAggInstTable = + ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable(); + } +*************** +*** 1560,1566 **** + } + + // allocate symbol widths storage +- symWidths = NULL; + if (huff && !refAgg) { + symWidths = (Guint *)gmallocn(numNewSyms, sizeof(Guint)); + } +--- 1612,1617 ---- +*************** +*** 1602,1607 **** +--- 1653,1662 ---- + goto syntaxError; + } + symWidth += dw; ++ if (i >= numNewSyms) { ++ error(getPos(), "Too many symbols in JBIG2 symbol dictionary"); ++ goto syntaxError; ++ } + + // using a collective bitmap, so don't read a bitmap here + if (huff && !refAgg) { +*************** +*** 1638,1643 **** +--- 1693,1702 ---- + arithDecoder->decodeInt(&refDX, iardxStats); + arithDecoder->decodeInt(&refDY, iardyStats); + } ++ if (symID >= numInputSyms + i) { ++ error(getPos(), "Invalid symbol ID in JBIG2 symbol dictionary"); ++ goto syntaxError; ++ } + refBitmap = bitmaps[symID]; + bitmaps[numInputSyms + i] = + readGenericRefinementRegion(symWidth, symHeight, +*************** +*** 1704,1709 **** +--- 1763,1774 ---- + } else { + arithDecoder->decodeInt(&run, iaexStats); + } ++ if (i + run > numInputSyms + numNewSyms || ++ (ex && j + run > numExSyms)) { ++ error(getPos(), "Too many exported symbols in JBIG2 symbol dictionary"); ++ delete symbolDict; ++ goto syntaxError; ++ } + if (ex) { + for (cnt = 0; cnt < run; ++cnt) { + symbolDict->setBitmap(j++, bitmaps[i++]->copy()); +*************** +*** 1713,1718 **** +--- 1778,1788 ---- + } + ex = !ex; + } ++ if (j != numExSyms) { ++ error(getPos(), "Too few symbols in JBIG2 symbol dictionary"); ++ delete symbolDict; ++ goto syntaxError; ++ } + + for (i = 0; i < numNewSyms; ++i) { + delete bitmaps[numInputSyms + i]; +*************** +*** 1735,1740 **** +--- 1805,1814 ---- + + return gTrue; + ++ codeTableError: ++ error(getPos(), "Missing code table in JBIG2 symbol dictionary"); ++ delete codeTables; ++ + syntaxError: + for (i = 0; i < numNewSyms; ++i) { + if (bitmaps[numInputSyms + i]) { +*************** +*** 1837,1842 **** +--- 1911,1918 ---- + } + } else { + error(getPos(), "Invalid segment reference in JBIG2 text region"); ++ delete codeTables; ++ return; + } + } + symCodeLen = 0; +*************** +*** 1871,1876 **** +--- 1947,1955 ---- + } else if (huffFS == 1) { + huffFSTable = huffTableG; + } else { ++ if (i >= (Guint)codeTables->getLength()) { ++ goto codeTableError; ++ } + huffFSTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable(); + } + if (huffDS == 0) { +*************** +*** 1880,1885 **** +--- 1959,1967 ---- + } else if (huffDS == 2) { + huffDSTable = huffTableJ; + } else { ++ if (i >= (Guint)codeTables->getLength()) { ++ goto codeTableError; ++ } + huffDSTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable(); + } + if (huffDT == 0) { +*************** +*** 1889,1894 **** +--- 1971,1979 ---- + } else if (huffDT == 2) { + huffDTTable = huffTableM; + } else { ++ if (i >= (Guint)codeTables->getLength()) { ++ goto codeTableError; ++ } + huffDTTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable(); + } + if (huffRDW == 0) { +*************** +*** 1896,1901 **** +--- 1981,1989 ---- + } else if (huffRDW == 1) { + huffRDWTable = huffTableO; + } else { ++ if (i >= (Guint)codeTables->getLength()) { ++ goto codeTableError; ++ } + huffRDWTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable(); + } + if (huffRDH == 0) { +*************** +*** 1903,1908 **** +--- 1991,1999 ---- + } else if (huffRDH == 1) { + huffRDHTable = huffTableO; + } else { ++ if (i >= (Guint)codeTables->getLength()) { ++ goto codeTableError; ++ } + huffRDHTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable(); + } + if (huffRDX == 0) { +*************** +*** 1910,1915 **** +--- 2001,2009 ---- + } else if (huffRDX == 1) { + huffRDXTable = huffTableO; + } else { ++ if (i >= (Guint)codeTables->getLength()) { ++ goto codeTableError; ++ } + huffRDXTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable(); + } + if (huffRDY == 0) { +*************** +*** 1917,1927 **** +--- 2011,2027 ---- + } else if (huffRDY == 1) { + huffRDYTable = huffTableO; + } else { ++ if (i >= (Guint)codeTables->getLength()) { ++ goto codeTableError; ++ } + huffRDYTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable(); + } + if (huffRSize == 0) { + huffRSizeTable = huffTableA; + } else { ++ if (i >= (Guint)codeTables->getLength()) { ++ goto codeTableError; ++ } + huffRSizeTable = + ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable(); + } +*************** +*** 2016,2023 **** +--- 2116,2130 ---- + + return; + ++ codeTableError: ++ error(getPos(), "Missing code table in JBIG2 text region"); ++ gfree(codeTables); ++ delete syms; ++ return; ++ + eofError: + error(getPos(), "Unexpected EOF in JBIG2 stream"); ++ return; + } + + JBIG2Bitmap *JBIG2Stream::readTextRegion(GBool huff, GBool refine, +*************** +*** 2324,2331 **** + error(getPos(), "Bad symbol dictionary reference in JBIG2 halftone segment"); + return; + } +! seg = findSegment(refSegs[0]); +! if (seg->getType() != jbig2SegPatternDict) { + error(getPos(), "Bad symbol dictionary reference in JBIG2 halftone segment"); + return; + } +--- 2431,2438 ---- + error(getPos(), "Bad symbol dictionary reference in JBIG2 halftone segment"); + return; + } +! if (!(seg = findSegment(refSegs[0])) || +! seg->getType() != jbig2SegPatternDict) { + error(getPos(), "Bad symbol dictionary reference in JBIG2 halftone segment"); + return; + } +*************** +*** 2483,2489 **** + + // read the bitmap + bitmap = readGenericBitmap(mmr, w, h, templ, tpgdOn, gFalse, +! NULL, atx, aty, mmr ? 0 : length - 18); + + // combine the region bitmap into the page bitmap + if (imm) { +--- 2590,2596 ---- + + // read the bitmap + bitmap = readGenericBitmap(mmr, w, h, templ, tpgdOn, gFalse, +! NULL, atx, aty, mmr ? length - 18 : 0); + + // combine the region bitmap into the page bitmap + if (imm) { +*************** +*** 2505,2510 **** +--- 2612,2654 ---- + error(getPos(), "Unexpected EOF in JBIG2 stream"); + } + ++ inline void JBIG2Stream::mmrAddPixels(int a1, int blackPixels, ++ int *codingLine, int *a0i, int w) { ++ if (a1 > codingLine[*a0i]) { ++ if (a1 > w) { ++ error(getPos(), "JBIG2 MMR row is wrong length ({0:d})", a1); ++ a1 = w; ++ } ++ if ((*a0i & 1) ^ blackPixels) { ++ ++*a0i; ++ } ++ codingLine[*a0i] = a1; ++ } ++ } ++ ++ inline void JBIG2Stream::mmrAddPixelsNeg(int a1, int blackPixels, ++ int *codingLine, int *a0i, int w) { ++ if (a1 > codingLine[*a0i]) { ++ if (a1 > w) { ++ error(getPos(), "JBIG2 MMR row is wrong length ({0:d})", a1); ++ a1 = w; ++ } ++ if ((*a0i & 1) ^ blackPixels) { ++ ++*a0i; ++ } ++ codingLine[*a0i] = a1; ++ } else if (a1 < codingLine[*a0i]) { ++ if (a1 < 0) { ++ error(getPos(), "Invalid JBIG2 MMR code"); ++ a1 = 0; ++ } ++ while (*a0i > 0 && a1 <= codingLine[*a0i - 1]) { ++ --*a0i; ++ } ++ codingLine[*a0i] = a1; ++ } ++ } ++ + JBIG2Bitmap *JBIG2Stream::readGenericBitmap(GBool mmr, int w, int h, + int templ, GBool tpgdOn, + GBool useSkip, JBIG2Bitmap *skip, +*************** +*** 2517,2523 **** + JBIG2BitmapPtr atPtr0, atPtr1, atPtr2, atPtr3; + int *refLine, *codingLine; + int code1, code2, code3; +! int x, y, a0, pix, i, refI, codingI; + + bitmap = new JBIG2Bitmap(0, w, h); + bitmap->clearToZero(); +--- 2661,2667 ---- + JBIG2BitmapPtr atPtr0, atPtr1, atPtr2, atPtr3; + int *refLine, *codingLine; + int code1, code2, code3; +! int x, y, a0i, b1i, blackPixels, pix, i; + + bitmap = new JBIG2Bitmap(0, w, h); + bitmap->clearToZero(); +*************** +*** 2527,2535 **** + if (mmr) { + + mmrDecoder->reset(); + refLine = (int *)gmallocn(w + 2, sizeof(int)); +! codingLine = (int *)gmallocn(w + 2, sizeof(int)); +! codingLine[0] = codingLine[1] = w; + + for (y = 0; y < h; ++y) { + +--- 2671,2688 ---- + if (mmr) { + + mmrDecoder->reset(); ++ if (w > INT_MAX - 2) { ++ error(getPos(), "Bad width in JBIG2 generic bitmap"); ++ // force a call to gmalloc(-1), which will throw an exception ++ w = -3; ++ } ++ // 0 <= codingLine[0] < codingLine[1] < ... < codingLine[n] = w ++ // ---> max codingLine size = w + 1 ++ // refLine has one extra guard entry at the end ++ // ---> max refLine size = w + 2 ++ codingLine = (int *)gmallocn(w + 1, sizeof(int)); + refLine = (int *)gmallocn(w + 2, sizeof(int)); +! codingLine[0] = w; + + for (y = 0; y < h; ++y) { + +*************** +*** 2537,2664 **** + for (i = 0; codingLine[i] < w; ++i) { + refLine[i] = codingLine[i]; + } +! refLine[i] = refLine[i + 1] = w; + + // decode a line +! refI = 0; // b1 = refLine[refI] +! codingI = 0; // a1 = codingLine[codingI] +! a0 = 0; +! do { + code1 = mmrDecoder->get2DCode(); + switch (code1) { + case twoDimPass: +! if (refLine[refI] < w) { +! a0 = refLine[refI + 1]; +! refI += 2; +! } +! break; + case twoDimHoriz: +! if (codingI & 1) { +! code1 = 0; +! do { +! code1 += code3 = mmrDecoder->getBlackCode(); +! } while (code3 >= 64); +! code2 = 0; +! do { +! code2 += code3 = mmrDecoder->getWhiteCode(); +! } while (code3 >= 64); +! } else { +! code1 = 0; +! do { +! code1 += code3 = mmrDecoder->getWhiteCode(); +! } while (code3 >= 64); +! code2 = 0; +! do { +! code2 += code3 = mmrDecoder->getBlackCode(); +! } while (code3 >= 64); +! } +! if (code1 > 0 || code2 > 0) { +! a0 = codingLine[codingI++] = a0 + code1; +! a0 = codingLine[codingI++] = a0 + code2; +! while (refLine[refI] <= a0 && refLine[refI] < w) { +! refI += 2; +! } +! } +! break; +! case twoDimVert0: +! a0 = codingLine[codingI++] = refLine[refI]; +! if (refLine[refI] < w) { +! ++refI; +! } +! break; +! case twoDimVertR1: +! a0 = codingLine[codingI++] = refLine[refI] + 1; +! if (refLine[refI] < w) { +! ++refI; +! while (refLine[refI] <= a0 && refLine[refI] < w) { +! refI += 2; +! } +! } +! break; +! case twoDimVertR2: +! a0 = codingLine[codingI++] = refLine[refI] + 2; +! if (refLine[refI] < w) { +! ++refI; +! while (refLine[refI] <= a0 && refLine[refI] < w) { +! refI += 2; +! } +! } +! break; + case twoDimVertR3: +! a0 = codingLine[codingI++] = refLine[refI] + 3; +! if (refLine[refI] < w) { +! ++refI; +! while (refLine[refI] <= a0 && refLine[refI] < w) { +! refI += 2; +! } +! } +! break; +! case twoDimVertL1: +! a0 = codingLine[codingI++] = refLine[refI] - 1; +! if (refI > 0) { +! --refI; +! } else { +! ++refI; +! } +! while (refLine[refI] <= a0 && refLine[refI] < w) { +! refI += 2; +! } +! break; +! case twoDimVertL2: +! a0 = codingLine[codingI++] = refLine[refI] - 2; +! if (refI > 0) { +! --refI; +! } else { +! ++refI; +! } +! while (refLine[refI] <= a0 && refLine[refI] < w) { +! refI += 2; +! } +! break; + case twoDimVertL3: +! a0 = codingLine[codingI++] = refLine[refI] - 3; +! if (refI > 0) { +! --refI; +! } else { +! ++refI; +! } +! while (refLine[refI] <= a0 && refLine[refI] < w) { +! refI += 2; +! } +! break; + default: + error(getPos(), "Illegal code in JBIG2 MMR bitmap data"); + break; + } +! } while (a0 < w); +! codingLine[codingI++] = w; + + // convert the run lengths to a bitmap line + i = 0; +! while (codingLine[i] < w) { + for (x = codingLine[i]; x < codingLine[i+1]; ++x) { + bitmap->setPixel(x, y); + } + i += 2; + } + } +--- 2690,2846 ---- + for (i = 0; codingLine[i] < w; ++i) { + refLine[i] = codingLine[i]; + } +! refLine[i++] = w; +! refLine[i] = w; + + // decode a line +! codingLine[0] = 0; +! a0i = 0; +! b1i = 0; +! blackPixels = 0; +! // invariant: +! // refLine[b1i-1] <= codingLine[a0i] < refLine[b1i] < refLine[b1i+1] <= w +! // exception at left edge: +! // codingLine[a0i = 0] = refLine[b1i = 0] = 0 is possible +! // exception at right edge: +! // refLine[b1i] = refLine[b1i+1] = w is possible +! while (codingLine[a0i] < w) { + code1 = mmrDecoder->get2DCode(); + switch (code1) { + case twoDimPass: +! mmrAddPixels(refLine[b1i + 1], blackPixels, codingLine, &a0i, w); +! if (refLine[b1i + 1] < w) { +! b1i += 2; +! } +! break; + case twoDimHoriz: +! code1 = code2 = 0; +! if (blackPixels) { +! do { +! code1 += code3 = mmrDecoder->getBlackCode(); +! } while (code3 >= 64); +! do { +! code2 += code3 = mmrDecoder->getWhiteCode(); +! } while (code3 >= 64); +! } else { +! do { +! code1 += code3 = mmrDecoder->getWhiteCode(); +! } while (code3 >= 64); +! do { +! code2 += code3 = mmrDecoder->getBlackCode(); +! } while (code3 >= 64); +! } +! mmrAddPixels(codingLine[a0i] + code1, blackPixels, +! codingLine, &a0i, w); +! if (codingLine[a0i] < w) { +! mmrAddPixels(codingLine[a0i] + code2, blackPixels ^ 1, +! codingLine, &a0i, w); +! } +! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) { +! b1i += 2; +! } +! break; + case twoDimVertR3: +! mmrAddPixels(refLine[b1i] + 3, blackPixels, codingLine, &a0i, w); +! blackPixels ^= 1; +! if (codingLine[a0i] < w) { +! ++b1i; +! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) { +! b1i += 2; +! } +! } +! break; +! case twoDimVertR2: +! mmrAddPixels(refLine[b1i] + 2, blackPixels, codingLine, &a0i, w); +! blackPixels ^= 1; +! if (codingLine[a0i] < w) { +! ++b1i; +! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) { +! b1i += 2; +! } +! } +! break; +! case twoDimVertR1: +! mmrAddPixels(refLine[b1i] + 1, blackPixels, codingLine, &a0i, w); +! blackPixels ^= 1; +! if (codingLine[a0i] < w) { +! ++b1i; +! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) { +! b1i += 2; +! } +! } +! break; +! case twoDimVert0: +! mmrAddPixels(refLine[b1i], blackPixels, codingLine, &a0i, w); +! blackPixels ^= 1; +! if (codingLine[a0i] < w) { +! ++b1i; +! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) { +! b1i += 2; +! } +! } +! break; + case twoDimVertL3: +! mmrAddPixelsNeg(refLine[b1i] - 3, blackPixels, codingLine, &a0i, w); +! blackPixels ^= 1; +! if (codingLine[a0i] < w) { +! if (b1i > 0) { +! --b1i; +! } else { +! ++b1i; +! } +! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) { +! b1i += 2; +! } +! } +! break; +! case twoDimVertL2: +! mmrAddPixelsNeg(refLine[b1i] - 2, blackPixels, codingLine, &a0i, w); +! blackPixels ^= 1; +! if (codingLine[a0i] < w) { +! if (b1i > 0) { +! --b1i; +! } else { +! ++b1i; +! } +! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) { +! b1i += 2; +! } +! } +! break; +! case twoDimVertL1: +! mmrAddPixelsNeg(refLine[b1i] - 1, blackPixels, codingLine, &a0i, w); +! blackPixels ^= 1; +! if (codingLine[a0i] < w) { +! if (b1i > 0) { +! --b1i; +! } else { +! ++b1i; +! } +! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) { +! b1i += 2; +! } +! } +! break; +! case EOF: +! mmrAddPixels(w, 0, codingLine, &a0i, w); +! break; + default: + error(getPos(), "Illegal code in JBIG2 MMR bitmap data"); ++ mmrAddPixels(w, 0, codingLine, &a0i, w); + break; + } +! } + + // convert the run lengths to a bitmap line + i = 0; +! while (1) { + for (x = codingLine[i]; x < codingLine[i+1]; ++x) { + bitmap->setPixel(x, y); + } ++ if (codingLine[i+1] >= w || codingLine[i+2] >= w) { ++ break; ++ } + i += 2; + } + } +*************** +*** 2706,2712 **** + ltp = !ltp; + } + if (ltp) { +! bitmap->duplicateRow(y, y-1); + continue; + } + } +--- 2888,2896 ---- + ltp = !ltp; + } + if (ltp) { +! if (y > 0) { +! bitmap->duplicateRow(y, y-1); +! } + continue; + } + } +*************** +*** 2909,2916 **** + return; + } + if (nRefSegs == 1) { +! seg = findSegment(refSegs[0]); +! if (seg->getType() != jbig2SegBitmap) { + error(getPos(), "Bad bitmap reference in JBIG2 generic refinement segment"); + return; + } +--- 3093,3100 ---- + return; + } + if (nRefSegs == 1) { +! if (!(seg = findSegment(refSegs[0])) || +! seg->getType() != jbig2SegBitmap) { + error(getPos(), "Bad bitmap reference in JBIG2 generic refinement segment"); + return; + } +*************** +*** 3004,3009 **** +--- 3188,3197 ---- + tpgrCX2 = refBitmap->nextPixel(&tpgrCXPtr2); + tpgrCX2 = (tpgrCX2 << 1) | refBitmap->nextPixel(&tpgrCXPtr2); + tpgrCX2 = (tpgrCX2 << 1) | refBitmap->nextPixel(&tpgrCXPtr2); ++ } else { ++ tpgrCXPtr0.p = tpgrCXPtr1.p = tpgrCXPtr2.p = NULL; // make gcc happy ++ tpgrCXPtr0.shift = tpgrCXPtr1.shift = tpgrCXPtr2.shift = 0; ++ tpgrCXPtr0.x = tpgrCXPtr1.x = tpgrCXPtr2.x = 0; + } + + for (x = 0; x < w; ++x) { +*************** +*** 3075,3080 **** +--- 3263,3272 ---- + tpgrCX2 = refBitmap->nextPixel(&tpgrCXPtr2); + tpgrCX2 = (tpgrCX2 << 1) | refBitmap->nextPixel(&tpgrCXPtr2); + tpgrCX2 = (tpgrCX2 << 1) | refBitmap->nextPixel(&tpgrCXPtr2); ++ } else { ++ tpgrCXPtr0.p = tpgrCXPtr1.p = tpgrCXPtr2.p = NULL; // make gcc happy ++ tpgrCXPtr0.shift = tpgrCXPtr1.shift = tpgrCXPtr2.shift = 0; ++ tpgrCXPtr0.x = tpgrCXPtr1.x = tpgrCXPtr2.x = 0; + } + + for (x = 0; x < w; ++x) { +diff -r -c xpdf-3.02.orig/xpdf/JBIG2Stream.h xpdf-3.02/xpdf/JBIG2Stream.h +*** xpdf-3.02.orig/xpdf/JBIG2Stream.h Tue Feb 27 14:05:52 2007 +--- xpdf-3.02/xpdf/JBIG2Stream.h Tue Mar 31 10:50:07 2009 +*************** +*** 78,83 **** +--- 78,87 ---- + Guint *refSegs, Guint nRefSegs); + void readGenericRegionSeg(Guint segNum, GBool imm, + GBool lossless, Guint length); ++ void mmrAddPixels(int a1, int blackPixels, ++ int *codingLine, int *a0i, int w); ++ void mmrAddPixelsNeg(int a1, int blackPixels, ++ int *codingLine, int *a0i, int w); + JBIG2Bitmap *readGenericBitmap(GBool mmr, int w, int h, + int templ, GBool tpgdOn, + GBool useSkip, JBIG2Bitmap *skip, diff --git a/xpdf-3.02pl4.patch b/xpdf-3.02pl4.patch new file mode 100644 index 0000000..082d117 --- /dev/null +++ b/xpdf-3.02pl4.patch @@ -0,0 +1,282 @@ +*** xpdf-3.02.orig/xpdf/Stream.cc Fri Jul 24 14:30:46 2009 +--- xpdf-3.02/xpdf/Stream.cc Mon Oct 5 11:07:49 2009 +*************** +*** 323,328 **** +--- 323,332 ---- + } 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; + } +*** xpdf-3.02.orig/xpdf/PSOutputDev.cc Tue Feb 27 14:05:52 2007 +--- xpdf-3.02/xpdf/PSOutputDev.cc Fri Oct 2 12:38:58 2009 +*************** +*** 4301,4307 **** + width, -height, height); + + // allocate a line buffer +! lineBuf = (Guchar *)gmalloc(4 * width); + + // set up to process the data stream + imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), +--- 4301,4307 ---- + width, -height, height); + + // allocate a line buffer +! lineBuf = (Guchar *)gmallocn(width, 4); + + // set up to process the data stream + imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), +diff -r -c xpdf-3.02.orig/splash/Splash.cc xpdf-3.02/splash/Splash.cc +*** xpdf-3.02.orig/splash/Splash.cc Tue Feb 27 14:05:52 2007 +--- xpdf-3.02/splash/Splash.cc Fri Aug 14 14:05:08 2009 +*************** +*** 12,17 **** +--- 12,18 ---- + + #include + #include ++ #include + #include "gmem.h" + #include "SplashErrorCodes.h" + #include "SplashMath.h" +*************** +*** 1912,1918 **** + xq = w % scaledWidth; + + // allocate pixel buffer +! pixBuf = (SplashColorPtr)gmalloc((yp + 1) * w); + + // initialize the pixel pipe + pipeInit(&pipe, 0, 0, state->fillPattern, NULL, state->fillAlpha, +--- 1913,1922 ---- + xq = w % scaledWidth; + + // allocate pixel buffer +! 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,2216 **** + xq = w % scaledWidth; + + // allocate pixel buffers +! colorBuf = (SplashColorPtr)gmalloc((yp + 1) * w * nComps); + if (srcAlpha) { +! alphaBuf = (Guchar *)gmalloc((yp + 1) * w); + } else { + alphaBuf = NULL; + } +--- 2212,2223 ---- + xq = w % scaledWidth; + + // allocate pixel buffers +! if (yp < 0 || yp > INT_MAX - 1 || w > INT_MAX / nComps) { +! return splashErrBadArg; +! } +! colorBuf = (SplashColorPtr)gmallocn(yp + 1, w * nComps); + if (srcAlpha) { +! alphaBuf = (Guchar *)gmallocn(yp + 1, w); + } else { + alphaBuf = NULL; + } +diff -r -c xpdf-3.02.orig/splash/SplashErrorCodes.h xpdf-3.02/splash/SplashErrorCodes.h +*** xpdf-3.02.orig/splash/SplashErrorCodes.h Tue Feb 27 14:05:52 2007 +--- xpdf-3.02/splash/SplashErrorCodes.h Fri Aug 14 14:03:46 2009 +*************** +*** 29,32 **** +--- 29,34 ---- + + #define splashErrSingularMatrix 8 // matrix is singular + ++ #define splashErrBadArg 9 // bad argument ++ + #endif +*** xpdf-3.02.orig/splash/SplashBitmap.cc Tue Feb 27 14:05:52 2007 +--- xpdf-3.02/splash/SplashBitmap.cc Wed Aug 19 14:55:39 2009 +*************** +*** 11,16 **** +--- 11,17 ---- + #endif + + #include ++ #include + #include "gmem.h" + #include "SplashErrorCodes.h" + #include "SplashBitmap.h" +*************** +*** 27,56 **** + mode = modeA; + switch (mode) { + case splashModeMono1: +! rowSize = (width + 7) >> 3; + break; + case splashModeMono8: +! rowSize = width; + break; + case splashModeRGB8: + case splashModeBGR8: +! rowSize = width * 3; + break; + #if SPLASH_CMYK + case splashModeCMYK8: +! rowSize = width * 4; + break; + #endif + } +! rowSize += rowPad - 1; +! rowSize -= rowSize % rowPad; +! data = (SplashColorPtr)gmalloc(rowSize * height); + if (!topDown) { + data += (height - 1) * rowSize; + rowSize = -rowSize; + } + if (alphaA) { +! alpha = (Guchar *)gmalloc(width * height); + } else { + alpha = NULL; + } +--- 28,75 ---- + mode = modeA; + switch (mode) { + case splashModeMono1: +! if (width > 0) { +! rowSize = (width + 7) >> 3; +! } else { +! rowSize = -1; +! } + break; + case splashModeMono8: +! if (width > 0) { +! rowSize = width; +! } else { +! rowSize = -1; +! } + break; + case splashModeRGB8: + case splashModeBGR8: +! if (width > 0 && width <= INT_MAX / 3) { +! rowSize = width * 3; +! } else { +! rowSize = -1; +! } + break; + #if SPLASH_CMYK + case splashModeCMYK8: +! if (width > 0 && width <= INT_MAX / 4) { +! rowSize = width * 4; +! } else { +! rowSize = -1; +! } + break; + #endif + } +! 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 *)gmallocn(width, height); + } else { + alpha = NULL; + } +*** xpdf-3.02.orig/xpdf/XRef.cc Tue Feb 27 14:05:52 2007 +--- xpdf-3.02/xpdf/XRef.cc Tue Oct 13 11:57:24 2009 +*************** +*** 52,57 **** +--- 52,59 ---- + // generation 0. + ObjectStream(XRef *xref, int objStrNumA); + ++ GBool isOk() { return ok; } ++ + ~ObjectStream(); + + // Return the object number of this object stream. +*************** +*** 67,72 **** +--- 69,75 ---- + 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,85 **** +--- 83,89 ---- + nObjects = 0; + objs = NULL; + objNums = NULL; ++ ok = gFalse; + + if (!xref->fetch(objStrNum, 0, &objStr)->isStream()) { + goto err1; +*************** +*** 105,110 **** +--- 109,121 ---- + 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,170 **** + } + + gfree(offsets); + + err1: + objStr.free(); +- return; + } + + ObjectStream::~ObjectStream() { +--- 172,181 ---- + } + + gfree(offsets); ++ ok = gTrue; + + err1: + objStr.free(); + } + + ObjectStream::~ObjectStream() { +*************** +*** 837,842 **** +--- 848,858 ---- + 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 --git a/xpdf-3.02pl5.patch b/xpdf-3.02pl5.patch new file mode 100644 index 0000000..558eac5 --- /dev/null +++ b/xpdf-3.02pl5.patch @@ -0,0 +1,41 @@ +*** xpdf-3.02.orig/xpdf/Gfx.cc Tue Feb 27 14:05:52 2007 +--- xpdf-3.02/xpdf/Gfx.cc Mon Oct 11 15:39:52 2010 +*************** +*** 461,466 **** +--- 461,467 ---- + baseMatrix[i] = state->getCTM()[i]; + } + formDepth = 0; ++ parser = NULL; + abortCheckCbk = abortCheckCbkA; + abortCheckCbkData = abortCheckCbkDataA; + +*************** +*** 500,505 **** +--- 501,507 ---- + baseMatrix[i] = state->getCTM()[i]; + } + formDepth = 0; ++ parser = NULL; + abortCheckCbk = abortCheckCbkA; + abortCheckCbkData = abortCheckCbkDataA; + +*** xpdf-3.02.orig/fofi/FoFiType1.cc Tue Feb 27 14:05:51 2007 +--- xpdf-3.02/fofi/FoFiType1.cc Mon Oct 11 15:44:13 2010 +*************** +*** 224,230 **** + code = code * 8 + (*p2 - '0'); + } + } +! if (code < 256) { + for (p = p2; *p == ' ' || *p == '\t'; ++p) ; + if (*p == '/') { + ++p; +--- 224,230 ---- + code = code * 8 + (*p2 - '0'); + } + } +! if (code >= 0 && code < 256) { + for (p = p2; *p == ' ' || *p == '\t'; ++p) ; + if (*p == '/') { + ++p; diff --git a/xpdf-3.03-64bit.patch b/xpdf-3.03-64bit.patch new file mode 100644 index 0000000..942ffe0 --- /dev/null +++ b/xpdf-3.03-64bit.patch @@ -0,0 +1,57 @@ +diff -up xpdf-3.03/goo/gmem.cc.alloc xpdf-3.03/goo/gmem.cc +--- xpdf-3.03/goo/gmem.cc.alloc 2011-08-15 17:08:53.000000000 -0400 ++++ xpdf-3.03/goo/gmem.cc 2011-08-22 13:48:31.891115878 -0400 +@@ -47,9 +47,9 @@ static int gMemInUse = 0; + + #endif /* DEBUG_MEM */ + +-void *gmalloc(int size) GMEM_EXCEP { ++void *gmalloc(size_t size) GMEM_EXCEP { + #ifdef DEBUG_MEM +- int size1; ++ size_t size1; + char *mem; + GMemHdr *hdr; + void *data; +@@ -122,11 +122,11 @@ void *gmalloc(int size) GMEM_EXCEP { + #endif + } + +-void *grealloc(void *p, int size) GMEM_EXCEP { ++void *grealloc(void *p, size_t size) GMEM_EXCEP { + #ifdef DEBUG_MEM + GMemHdr *hdr; + void *q; +- int oldSize; ++ size_t oldSize; + + if (size < 0) { + #if USE_EXCEPTIONS +@@ -227,7 +227,7 @@ void *greallocn(void *p, int nObjs, int + + void gfree(void *p) { + #ifdef DEBUG_MEM +- int size; ++ size_t size; + GMemHdr *hdr; + unsigned long *trl, *clr; + +diff -up xpdf-3.03/goo/gmem.h.alloc xpdf-3.03/goo/gmem.h +--- xpdf-3.03/goo/gmem.h.alloc 2011-08-15 17:08:53.000000000 -0400 ++++ xpdf-3.03/goo/gmem.h 2011-08-22 13:47:27.274853540 -0400 +@@ -36,13 +36,13 @@ extern "C" { + * Same as malloc, but prints error message and exits if malloc() + * returns NULL. + */ +-extern void *gmalloc(int size) GMEM_EXCEP; ++extern void *gmalloc(size_t size) GMEM_EXCEP; + + /* + * Same as realloc, but prints error message and exits if realloc() + * returns NULL. If

is NULL, calls malloc instead of realloc(). + */ +-extern void *grealloc(void *p, int size) GMEM_EXCEP; ++extern void *grealloc(void *p, size_t size) GMEM_EXCEP; + + /* + * These are similar to gmalloc and grealloc, but take an object count diff --git a/xpdf-3.03-CVE-2012-2142.diff b/xpdf-3.03-CVE-2012-2142.diff new file mode 100644 index 0000000..891c41f --- /dev/null +++ b/xpdf-3.03-CVE-2012-2142.diff @@ -0,0 +1,55 @@ +From 3945969e0072217c143fefa3044512a31ac2afa8 Mon Sep 17 00:00:00 2001 +From: mancha +Date: Sun, 11 Aug 2013 +Subject: CVE-2012-2142 + +Filter stuff that might end up in the shell to address CVE-2012-2142. +This code was adapted from the Poppler project. +--- + Error.cc | 21 ++++++++++++++++----- + 1 file changed, 16 insertions(+), 5 deletions(-) + +--- a/xpdf/Error.cc 2013-08-11 ++++ b/xpdf/Error.cc 2013-08-11 +@@ -43,7 +43,7 @@ void setErrorCallback(void (*cbk)(void * + + void CDECL error(ErrorCategory category, int pos, const char *msg, ...) { + va_list args; +- GString *s; ++ GString *s, *sanitized; + + // NB: this can be called before the globalParams object is created + if (!errorCbk && globalParams && globalParams->getErrQuiet()) { +@@ -52,17 +52,28 @@ void CDECL error(ErrorCategory category, + va_start(args, msg); + s = GString::formatv(msg, args); + va_end(args); ++ ++ sanitized = new GString (); ++ for (int i = 0; i < s->getLength(); ++i) { ++ const char c = s->getChar(i); ++ if (c < (char)0x20 || c >= (char)0x7f) { ++ sanitized->appendf("<{0:02x}>", c & 0xff); ++ } else { ++ sanitized->append(c); ++ } ++ } ++ + if (errorCbk) { +- (*errorCbk)(errorCbkData, category, pos, s->getCString()); ++ (*errorCbk)(errorCbkData, category, pos, sanitized->getCString()); + } else { + if (pos >= 0) { + fprintf(stderr, "%s (%d): %s\n", +- errorCategoryNames[category], pos, s->getCString()); ++ errorCategoryNames[category], pos, sanitized->getCString()); + } else { + fprintf(stderr, "%s: %s\n", +- errorCategoryNames[category], s->getCString()); ++ errorCategoryNames[category], sanitized->getCString()); + } + fflush(stderr); + } +- delete s; ++ delete sanitized; + } diff --git a/xpdf-3.03-compile-fix.patch b/xpdf-3.03-compile-fix.patch new file mode 100644 index 0000000..b28c369 --- /dev/null +++ b/xpdf-3.03-compile-fix.patch @@ -0,0 +1,12 @@ +diff -up xpdf-3.03/xpdf/XPDFViewer.cc.BAD xpdf-3.03/xpdf/XPDFViewer.cc +--- xpdf-3.03/xpdf/XPDFViewer.cc.BAD 2011-08-22 14:19:42.845075813 -0400 ++++ xpdf-3.03/xpdf/XPDFViewer.cc 2011-08-22 14:19:47.953013145 -0400 +@@ -1807,7 +1807,7 @@ void XPDFViewer::initToolbar(Widget pare + menuPane = XmCreatePulldownMenu(toolBar, "zoomMenuPane", args, n); + for (i = 0; i < nZoomMenuItems; ++i) { + n = 0; +- s = XmStringCreateLocalized(zoomMenuInfo[i].label); ++ s = XmStringCreateLocalized((char *)zoomMenuInfo[i].label); + XtSetArg(args[n], XmNlabelString, s); ++n; + XtSetArg(args[n], XmNuserData, (XtPointer)i); ++n; + sprintf(buf, "zoom%d", i); diff --git a/xpdf-3.03-crash.patch b/xpdf-3.03-crash.patch new file mode 100644 index 0000000..5c16bfe --- /dev/null +++ b/xpdf-3.03-crash.patch @@ -0,0 +1,48 @@ +diff -up xpdf-3.03/fofi/FoFiType1.cc.crash xpdf-3.03/fofi/FoFiType1.cc +--- xpdf-3.03/fofi/FoFiType1.cc.crash 2011-08-15 17:08:53.000000000 -0400 ++++ xpdf-3.03/fofi/FoFiType1.cc 2011-08-22 13:44:32.936859153 -0400 +@@ -268,9 +268,14 @@ void FoFiType1::parse() { + } + } + } else { +- if (strtok(buf, " \t") && +- (p = strtok(NULL, " \t\n\r")) && !strcmp(p, "def")) { +- break; ++ p = strtok(buf, " \t\n\r"); ++ if (p) ++ { ++ if (!strcmp(p, "def")) break; ++ if (!strcmp(p, "readonly")) break; ++ // the spec does not says this but i'm mantaining old xpdf behaviour that accepts "foo def" as end of the encoding array ++ p = strtok(buf, " \t\n\r"); ++ if (p && !strcmp(p, "def")) break; + } + } + } +diff -up xpdf-3.03/splash/Splash.cc.crash xpdf-3.03/splash/Splash.cc +--- xpdf-3.03/splash/Splash.cc.crash 2011-08-15 17:08:53.000000000 -0400 ++++ xpdf-3.03/splash/Splash.cc 2011-08-22 13:46:54.295231194 -0400 +@@ -2053,6 +2053,11 @@ SplashError Splash::fillWithPattern(Spla + xPath->aaScale(); + } + xPath->sort(); ++ if (!&xPath->segs[0]) ++ { ++ delete xPath; ++ return splashErrEmptyPath; ++ } + yMinI = state->clip->getYMinI(); + yMaxI = state->clip->getYMaxI(); + if (vectorAntialias && !inShading) { +@@ -2194,6 +2199,11 @@ SplashError Splash::xorFill(SplashPath * + } + xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue); + xPath->sort(); ++ if (!&xPath->segs[0]) ++ { ++ delete xPath; ++ return splashErrEmptyPath; ++ } + scanner = new SplashXPathScanner(xPath, eo, state->clip->getYMinI(), + state->clip->getYMaxI()); + diff --git a/xpdf-3.03-ext.patch b/xpdf-3.03-ext.patch new file mode 100644 index 0000000..3115d65 --- /dev/null +++ b/xpdf-3.03-ext.patch @@ -0,0 +1,51 @@ +diff -up xpdf-3.03/goo/gfile.cc.ext xpdf-3.03/goo/gfile.cc +--- xpdf-3.03/goo/gfile.cc.ext 2011-08-15 17:08:53.000000000 -0400 ++++ xpdf-3.03/goo/gfile.cc 2011-08-22 13:43:54.540304026 -0400 +@@ -507,32 +507,14 @@ GBool openTempFile(GString **name, FILE + char *s; + int fd; + +- if (ext) { +-#if HAVE_MKSTEMPS +- if ((s = getenv("TMPDIR"))) { +- *name = new GString(s); +- } else { +- *name = new GString("/tmp"); +- } +- (*name)->append("/XXXXXX")->append(ext); +- fd = mkstemps((*name)->getCString(), strlen(ext)); +-#else +- if (!(s = tmpnam(NULL))) { +- return gFalse; +- } ++#if HAVE_MKSTEMP ++ if ((s = getenv("TMPDIR"))) { + *name = new GString(s); +- (*name)->append(ext); +- fd = open((*name)->getCString(), O_WRONLY | O_CREAT | O_EXCL, 0600); +-#endif + } else { +-#if HAVE_MKSTEMP +- if ((s = getenv("TMPDIR"))) { +- *name = new GString(s); +- } else { +- *name = new GString("/tmp"); +- } +- (*name)->append("/XXXXXX"); +- fd = mkstemp((*name)->getCString()); ++ *name = new GString("/tmp"); ++ } ++ (*name)->append("/XXXXXX"); ++ fd = mkstemp((*name)->getCString()); + #else // HAVE_MKSTEMP + if (!(s = tmpnam(NULL))) { + return gFalse; +@@ -540,7 +522,7 @@ GBool openTempFile(GString **name, FILE + *name = new GString(s); + fd = open((*name)->getCString(), O_WRONLY | O_CREAT | O_EXCL, 0600); + #endif // HAVE_MKSTEMP +- } ++ + if (fd < 0 || !(*f = fdopen(fd, mode))) { + delete *name; + *name = NULL; diff --git a/xpdf-3.04-64bit.patch b/xpdf-3.04-64bit.patch new file mode 100644 index 0000000..49e3052 --- /dev/null +++ b/xpdf-3.04-64bit.patch @@ -0,0 +1,57 @@ +diff -up xpdf-3.04/goo/gmem.cc.alloc xpdf-3.04/goo/gmem.cc +--- xpdf-3.04/goo/gmem.cc.alloc 2014-05-28 14:50:50.000000000 -0400 ++++ xpdf-3.04/goo/gmem.cc 2014-05-29 15:00:18.670819951 -0400 +@@ -48,9 +48,9 @@ static int gMaxMemInUse = 0; + + #endif /* DEBUG_MEM */ + +-void *gmalloc(int size) GMEM_EXCEP { ++void *gmalloc(size_t size) GMEM_EXCEP { + #ifdef DEBUG_MEM +- int size1; ++ size_t size1; + char *mem; + GMemHdr *hdr; + void *data; +@@ -106,11 +106,11 @@ void *gmalloc(int size) GMEM_EXCEP { + #endif + } + +-void *grealloc(void *p, int size) GMEM_EXCEP { ++void *grealloc(void *p, size_t size) GMEM_EXCEP { + #ifdef DEBUG_MEM + GMemHdr *hdr; + void *q; +- int oldSize; ++ size_t oldSize; + + if (size < 0) { + gMemError("Invalid memory allocation size"); +@@ -186,7 +186,7 @@ void *greallocn(void *p, int nObjs, int + + void gfree(void *p) { + #ifdef DEBUG_MEM +- int size; ++ size_t size; + GMemHdr *hdr; + unsigned long *trl, *clr; + +diff -up xpdf-3.04/goo/gmem.h.alloc xpdf-3.04/goo/gmem.h +--- xpdf-3.04/goo/gmem.h.alloc 2014-05-28 14:50:50.000000000 -0400 ++++ xpdf-3.04/goo/gmem.h 2014-05-29 14:59:04.364344108 -0400 +@@ -36,13 +36,13 @@ extern "C" { + * Same as malloc, but prints error message and exits if malloc() + * returns NULL. + */ +-extern void *gmalloc(int size) GMEM_EXCEP; ++extern void *gmalloc(size_t size) GMEM_EXCEP; + + /* + * Same as realloc, but prints error message and exits if realloc() + * returns NULL. If

is NULL, calls malloc instead of realloc(). + */ +-extern void *grealloc(void *p, int size) GMEM_EXCEP; ++extern void *grealloc(void *p, size_t size) GMEM_EXCEP; + + /* + * These are similar to gmalloc and grealloc, but take an object count diff --git a/xpdf-3.04-crash.patch b/xpdf-3.04-crash.patch new file mode 100644 index 0000000..a816d89 --- /dev/null +++ b/xpdf-3.04-crash.patch @@ -0,0 +1,22 @@ +diff -up xpdf-3.04/fofi/FoFiType1.cc.crash xpdf-3.04/fofi/FoFiType1.cc +--- xpdf-3.04/fofi/FoFiType1.cc.crash 2014-05-28 14:50:50.000000000 -0400 ++++ xpdf-3.04/fofi/FoFiType1.cc 2014-05-29 14:56:09.199571189 -0400 +@@ -268,9 +268,14 @@ void FoFiType1::parse() { + } + } + } else { +- if (strtok(buf, " \t") && +- (p = strtok(NULL, " \t\n\r")) && !strcmp(p, "def")) { +- break; ++ p = strtok(buf, " \t\n\r"); ++ if (p) ++ { ++ if (!strcmp(p, "def")) break; ++ if (!strcmp(p, "readonly")) break; ++ // the spec does not says this but i'm mantaining old xpdf behaviour that accepts "foo def" as end of the encoding array ++ p = strtok(buf, " \t\n\r"); ++ if (p && !strcmp(p, "def")) break; + } + } + } +diff -up xpdf-3.04/splash/Splash.cc.crash xpdf-3.04/splash/Splash.cc diff --git a/xpdf-3.04-localized.patch b/xpdf-3.04-localized.patch new file mode 100644 index 0000000..504d3be --- /dev/null +++ b/xpdf-3.04-localized.patch @@ -0,0 +1,11 @@ +diff -up xpdf-3.04/xpdf/XPDFApp.cc.localized xpdf-3.04/xpdf/XPDFApp.cc +--- xpdf-3.04/xpdf/XPDFApp.cc.localized 2014-12-02 13:54:56.720680945 -0500 ++++ xpdf-3.04/xpdf/XPDFApp.cc 2014-12-02 13:55:10.257585002 -0500 +@@ -125,6 +125,7 @@ static int xErrorHandler(Display *displa + #endif + + XPDFApp::XPDFApp(int *argc, char *argv[]) { ++ XtSetLanguageProc(NULL, (XtLanguageProc)NULL, NULL); + appShell = XtAppInitialize(&appContext, xpdfAppName, xOpts, nXOpts, + argc, argv, fallbackResources, NULL, 0); + display = XtDisplay(appShell); diff --git a/xpdf-3.04-nocmap.patch b/xpdf-3.04-nocmap.patch new file mode 100644 index 0000000..1c381ae --- /dev/null +++ b/xpdf-3.04-nocmap.patch @@ -0,0 +1,53 @@ +diff -up xpdf-3.04/xpdf-chinese-simplified/add-to-xpdfrc.orig xpdf-3.04/xpdf-chinese-simplified/add-to-xpdfrc +--- xpdf-3.04/xpdf-chinese-simplified/add-to-xpdfrc.orig 2014-05-29 15:01:29.238318492 -0400 ++++ xpdf-3.04/xpdf-chinese-simplified/add-to-xpdfrc 2014-05-29 15:02:30.453883329 -0400 +@@ -3,7 +3,7 @@ cidToUnicode Adobe-GB1 /usr/share/xpdf/ch + unicodeMap ISO-2022-CN /usr/share/xpdf/chinese-simplified/ISO-2022-CN.unicodeMap + unicodeMap EUC-CN /usr/share/xpdf/chinese-simplified/EUC-CN.unicodeMap + unicodeMap GBK /usr/share/xpdf/chinese-simplified/GBK.unicodeMap +-cMapDir Adobe-GB1 /usr/share/xpdf/chinese-simplified/CMap +-toUnicodeDir /usr/share/xpdf/chinese-simplified/CMap ++#cMapDir Adobe-GB1 /usr/share/xpdf/chinese-simplified/CMap ++#toUnicodeDir /usr/share/xpdf/chinese-simplified/CMap + #fontFileCC Adobe-GB1 /usr/..../gkai00mp.ttf + #----- end Chinese Simplified support package +diff -up xpdf-3.04/xpdf-chinese-traditional/add-to-xpdfrc.orig xpdf-3.04/xpdf-chinese-traditional/add-to-xpdfrc +--- xpdf-3.04/xpdf-chinese-traditional/add-to-xpdfrc.orig 2014-05-29 15:01:29.237318499 -0400 ++++ xpdf-3.04/xpdf-chinese-traditional/add-to-xpdfrc 2014-05-29 15:02:01.979085766 -0400 +@@ -2,7 +2,7 @@ + cidToUnicode Adobe-CNS1 /usr/share/xpdf/chinese-traditional/Adobe-CNS1.cidToUnicode + unicodeMap Big5 /usr/share/xpdf/chinese-traditional/Big5.unicodeMap + unicodeMap Big5ascii /usr/share/xpdf/chinese-traditional/Big5ascii.unicodeMap +-cMapDir Adobe-CNS1 /usr/share/xpdf/chinese-traditional/CMap +-toUnicodeDir /usr/share/xpdf/chinese-traditional/CMap ++#cMapDir Adobe-CNS1 /usr/share/xpdf/chinese-traditional/CMap ++#toUnicodeDir /usr/share/xpdf/chinese-traditional/CMap + #fontFileCC Adobe-CNS1 /usr/..../bkai00mp.ttf + #----- end Chinese Traditional support package +diff -up xpdf-3.04/xpdf-japanese/add-to-xpdfrc.orig xpdf-3.04/xpdf-japanese/add-to-xpdfrc +--- xpdf-3.04/xpdf-japanese/add-to-xpdfrc.orig 2014-05-29 15:01:29.238318492 -0400 ++++ xpdf-3.04/xpdf-japanese/add-to-xpdfrc 2014-05-29 15:02:43.814788329 -0400 +@@ -3,7 +3,7 @@ cidToUnicode Adobe-Japan1 /usr/share/xpdf + unicodeMap ISO-2022-JP /usr/share/xpdf/japanese/ISO-2022-JP.unicodeMap + unicodeMap EUC-JP /usr/share/xpdf/japanese/EUC-JP.unicodeMap + unicodeMap Shift-JIS /usr/share/xpdf/japanese/Shift-JIS.unicodeMap +-cMapDir Adobe-Japan1 /usr/share/xpdf/japanese/CMap +-toUnicodeDir /usr/share/xpdf/japanese/CMap ++#cMapDir Adobe-Japan1 /usr/share/xpdf/japanese/CMap ++#toUnicodeDir /usr/share/xpdf/japanese/CMap + #fontFileCC Adobe-Japan1 /usr/..../kochi-mincho.ttf + #----- end Japanese support package +diff -up xpdf-3.04/xpdf-korean/add-to-xpdfrc.orig xpdf-3.04/xpdf-korean/add-to-xpdfrc +--- xpdf-3.04/xpdf-korean/add-to-xpdfrc.orig 2014-05-29 15:01:29.238318492 -0400 ++++ xpdf-3.04/xpdf-korean/add-to-xpdfrc 2014-05-29 15:02:16.581981953 -0400 +@@ -1,8 +1,8 @@ + #----- begin Korean support package (2011-sep-02) + cidToUnicode Adobe-Korea1 /usr/share/xpdf/korean/Adobe-Korea1.cidToUnicode + unicodeMap ISO-2022-KR /usr/share/xpdf/korean/ISO-2022-KR.unicodeMap +-cMapDir Adobe-Korea1 /usr/share/xpdf/korean/CMap +-toUnicodeDir /usr/share/xpdf/korean/CMap ++#cMapDir Adobe-Korea1 /usr/share/xpdf/korean/CMap ++#toUnicodeDir /usr/share/xpdf/korean/CMap + #fontFileCC Adobe-Korea1 /usr/..../batang.ttf" + #fontFileCC Unidocs-Korea1 /usr/..../batang.ttf" + #----- end Korean support package diff --git a/xpdf-3.04-pdftopng.patch b/xpdf-3.04-pdftopng.patch new file mode 100644 index 0000000..6229d0a --- /dev/null +++ b/xpdf-3.04-pdftopng.patch @@ -0,0 +1,32 @@ +diff -up xpdf-3.04/Makefile.in.pdftopng xpdf-3.04/Makefile.in +--- xpdf-3.04/Makefile.in.pdftopng 2014-05-29 15:56:14.405875939 -0400 ++++ xpdf-3.04/Makefile.in 2014-05-29 15:58:11.755031543 -0400 +@@ -37,6 +37,12 @@ xpdf: dummy + cd @UP_DIR@splash; $(MAKE) + cd @UP_DIR@xpdf; $(MAKE) xpdf$(EXE) + ++pdftopng: dummy ++ cd goo; $(MAKE) ++ cd @UP_DIR@fofi; $(MAKE) ++ cd @UP_DIR@splash; $(MAKE) ++ cd @UP_DIR@xpdf; $(MAKE) pdftopng$(EXE) ++ + pdftops: dummy + cd goo; $(MAKE) + cd @UP_DIR@fofi; $(MAKE) +@@ -91,6 +97,7 @@ install: dummy + $(INSTALL_PROGRAM) xpdf/pdfdetach$(EXE) $(DESTDIR)@bindir@/pdfdetach$(EXE) + @X@ $(INSTALL_PROGRAM) xpdf/pdftoppm$(EXE) $(DESTDIR)@bindir@/pdftoppm$(EXE) + $(INSTALL_PROGRAM) xpdf/pdfimages$(EXE) $(DESTDIR)@bindir@/pdfimages$(EXE) ++ $(INSTALL_PROGRAM) xpdf/pdftopng$(EXE) $(DESTDIR)@bindir@/pdftopng$(EXE) + -mkdir -p $(DESTDIR)@mandir@/man1 + @X@ $(INSTALL_DATA) $(srcdir)/doc/xpdf.1 $(DESTDIR)@mandir@/man1/xpdf.1 + $(INSTALL_DATA) $(srcdir)/doc/pdftops.1 $(DESTDIR)@mandir@/man1/pdftops.1 +@@ -100,6 +107,7 @@ install: dummy + $(INSTALL_DATA) $(srcdir)/doc/pdfdetach.1 $(DESTDIR)@mandir@/man1/pdfdetach.1 + @X@ $(INSTALL_DATA) $(srcdir)/doc/pdftoppm.1 $(DESTDIR)@mandir@/man1/pdftoppm.1 + $(INSTALL_DATA) $(srcdir)/doc/pdfimages.1 $(DESTDIR)@mandir@/man1/pdfimages.1 ++ $(INSTALL_DATA) $(srcdir)/doc/pdftopng.1 $(DESTDIR)@mandir@/man1/pdftopng.1 + -mkdir -p $(DESTDIR)@mandir@/man5 + $(INSTALL_DATA) $(srcdir)/doc/xpdfrc.5 $(DESTDIR)@mandir@/man5/xpdfrc.5 + -mkdir -p $(DESTDIR)@sysconfdir@ diff --git a/xpdf-3.04-redhat-new.patch b/xpdf-3.04-redhat-new.patch new file mode 100644 index 0000000..d19d9b0 --- /dev/null +++ b/xpdf-3.04-redhat-new.patch @@ -0,0 +1,136 @@ +diff -up xpdf-3.04/doc/sample-xpdfrc.orig xpdf-3.04/doc/sample-xpdfrc +--- xpdf-3.04/doc/sample-xpdfrc.orig 2014-05-28 14:50:50.000000000 -0400 ++++ xpdf-3.04/doc/sample-xpdfrc 2014-05-29 14:50:23.704974484 -0400 +@@ -56,7 +56,7 @@ + + # Set the default PostScript file or command. + +-#psFile "|lpr -Pmyprinter" ++psFile "|lpr" + + # Set the default PostScript paper size -- this can be letter, legal, + # A4, or A3. You can also specify a paper size as width and height +@@ -88,4 +88,10 @@ + # clicked. + + #launchCommand viewer-script +-#urlCommand "netscape -remote 'openURL(%s)'" ++urlCommand "xdg-open '%s'" ++ ++# CJK ++include /etc/xpdf/add-to-xpdfrc.japanese ++include /etc/xpdf/add-to-xpdfrc.korean ++include /etc/xpdf/add-to-xpdfrc.chinese-simplified ++include /etc/xpdf/add-to-xpdfrc.chinese-traditional +diff -up xpdf-3.04/doc/xpdfrc.5.orig xpdf-3.04/doc/xpdfrc.5 +--- xpdf-3.04/doc/xpdfrc.5.orig 2014-05-28 14:50:50.000000000 -0400 ++++ xpdf-3.04/doc/xpdfrc.5 2014-05-29 14:50:23.701974504 -0400 +@@ -7,7 +7,7 @@ All of the Xpdf tools read a single conf + .I .xpdfrc + file in your home directory, it will be read. Otherwise, a + system-wide configuration file will be read from +-.IR /usr/local/etc/xpdfrc , ++.IR /etc/xpdfrc , + if it exists. (This is its default location; depending on build + options, it may be placed elsewhere.) On Win32 systems, the + .I xpdfrc +@@ -672,7 +672,7 @@ urlCommand "netscape \-remote 'open + .fi + .SH FILES + .TP +-.B /usr/local/etc/xpdfrc ++.B /etc/xpdfrc + This is the default location for the system-wide configuration file. + Depending on build options, it may be placed elsewhere. + .TP +diff -up xpdf-3.04/xpdf-chinese-simplified/add-to-xpdfrc.orig xpdf-3.04/xpdf-chinese-simplified/add-to-xpdfrc +--- xpdf-3.04/xpdf-chinese-simplified/add-to-xpdfrc.orig 2014-05-29 14:50:23.700974511 -0400 ++++ xpdf-3.04/xpdf-chinese-simplified/add-to-xpdfrc 2014-05-29 14:53:15.316783717 -0400 +@@ -1,9 +1,9 @@ + #----- begin Chinese Simplified support package (2011-sep-02) +-cidToUnicode Adobe-GB1 /usr/local/share/xpdf/chinese-simplified/Adobe-GB1.cidToUnicode +-unicodeMap ISO-2022-CN /usr/local/share/xpdf/chinese-simplified/ISO-2022-CN.unicodeMap +-unicodeMap EUC-CN /usr/local/share/xpdf/chinese-simplified/EUC-CN.unicodeMap +-unicodeMap GBK /usr/local/share/xpdf/chinese-simplified/GBK.unicodeMap +-cMapDir Adobe-GB1 /usr/local/share/xpdf/chinese-simplified/CMap +-toUnicodeDir /usr/local/share/xpdf/chinese-simplified/CMap ++cidToUnicode Adobe-GB1 /usr/share/xpdf/chinese-simplified/Adobe-GB1.cidToUnicode ++unicodeMap ISO-2022-CN /usr/share/xpdf/chinese-simplified/ISO-2022-CN.unicodeMap ++unicodeMap EUC-CN /usr/share/xpdf/chinese-simplified/EUC-CN.unicodeMap ++unicodeMap GBK /usr/share/xpdf/chinese-simplified/GBK.unicodeMap ++cMapDir Adobe-GB1 /usr/share/xpdf/chinese-simplified/CMap ++toUnicodeDir /usr/share/xpdf/chinese-simplified/CMap + #fontFileCC Adobe-GB1 /usr/..../gkai00mp.ttf + #----- end Chinese Simplified support package +diff -up xpdf-3.04/xpdf-chinese-traditional/add-to-xpdfrc.orig xpdf-3.04/xpdf-chinese-traditional/add-to-xpdfrc +--- xpdf-3.04/xpdf-chinese-traditional/add-to-xpdfrc.orig 2014-05-29 14:50:23.699974518 -0400 ++++ xpdf-3.04/xpdf-chinese-traditional/add-to-xpdfrc 2014-05-29 14:53:15.321783682 -0400 +@@ -1,8 +1,8 @@ + #----- begin Chinese Traditional support package (2011-sep-02) +-cidToUnicode Adobe-CNS1 /usr/local/share/xpdf/chinese-traditional/Adobe-CNS1.cidToUnicode +-unicodeMap Big5 /usr/local/share/xpdf/chinese-traditional/Big5.unicodeMap +-unicodeMap Big5ascii /usr/local/share/xpdf/chinese-traditional/Big5ascii.unicodeMap +-cMapDir Adobe-CNS1 /usr/local/share/xpdf/chinese-traditional/CMap +-toUnicodeDir /usr/local/share/xpdf/chinese-traditional/CMap ++cidToUnicode Adobe-CNS1 /usr/share/xpdf/chinese-traditional/Adobe-CNS1.cidToUnicode ++unicodeMap Big5 /usr/share/xpdf/chinese-traditional/Big5.unicodeMap ++unicodeMap Big5ascii /usr/share/xpdf/chinese-traditional/Big5ascii.unicodeMap ++cMapDir Adobe-CNS1 /usr/share/xpdf/chinese-traditional/CMap ++toUnicodeDir /usr/share/xpdf/chinese-traditional/CMap + #fontFileCC Adobe-CNS1 /usr/..../bkai00mp.ttf + #----- end Chinese Traditional support package +diff -up xpdf-3.04/xpdf-cyrillic/add-to-xpdfrc.orig xpdf-3.04/xpdf-cyrillic/add-to-xpdfrc +--- xpdf-3.04/xpdf-cyrillic/add-to-xpdfrc.orig 2014-05-29 14:50:23.704974484 -0400 ++++ xpdf-3.04/xpdf-cyrillic/add-to-xpdfrc 2014-05-29 14:53:15.325783654 -0400 +@@ -1,4 +1,4 @@ + #----- begin Cyrillic support package (2011-aug-15) +-nameToUnicode /usr/local/share/xpdf/cyrillic/Bulgarian.nameToUnicode +-unicodeMap KOI8-R /usr/local/share/xpdf/cyrillic/KOI8-R.unicodeMap ++nameToUnicode /usr/share/xpdf/cyrillic/Bulgarian.nameToUnicode ++unicodeMap KOI8-R /usr/share/xpdf/cyrillic/KOI8-R.unicodeMap + #----- end Cyrillic support package +diff -up xpdf-3.04/xpdf-japanese/add-to-xpdfrc.orig xpdf-3.04/xpdf-japanese/add-to-xpdfrc +--- xpdf-3.04/xpdf-japanese/add-to-xpdfrc.orig 2014-05-29 14:50:23.700974511 -0400 ++++ xpdf-3.04/xpdf-japanese/add-to-xpdfrc 2014-05-29 14:53:15.340783550 -0400 +@@ -1,9 +1,9 @@ + #----- begin Japanese support package (2011-sep-02) +-cidToUnicode Adobe-Japan1 /usr/local/share/xpdf/japanese/Adobe-Japan1.cidToUnicode +-unicodeMap ISO-2022-JP /usr/local/share/xpdf/japanese/ISO-2022-JP.unicodeMap +-unicodeMap EUC-JP /usr/local/share/xpdf/japanese/EUC-JP.unicodeMap +-unicodeMap Shift-JIS /usr/local/share/xpdf/japanese/Shift-JIS.unicodeMap +-cMapDir Adobe-Japan1 /usr/local/share/xpdf/japanese/CMap +-toUnicodeDir /usr/local/share/xpdf/japanese/CMap ++cidToUnicode Adobe-Japan1 /usr/share/xpdf/japanese/Adobe-Japan1.cidToUnicode ++unicodeMap ISO-2022-JP /usr/share/xpdf/japanese/ISO-2022-JP.unicodeMap ++unicodeMap EUC-JP /usr/share/xpdf/japanese/EUC-JP.unicodeMap ++unicodeMap Shift-JIS /usr/share/xpdf/japanese/Shift-JIS.unicodeMap ++cMapDir Adobe-Japan1 /usr/share/xpdf/japanese/CMap ++toUnicodeDir /usr/share/xpdf/japanese/CMap + #fontFileCC Adobe-Japan1 /usr/..../kochi-mincho.ttf + #----- end Japanese support package +diff -up xpdf-3.04/xpdf-korean/add-to-xpdfrc.orig xpdf-3.04/xpdf-korean/add-to-xpdfrc +--- xpdf-3.04/xpdf-korean/add-to-xpdfrc.orig 2014-05-29 14:50:23.700974511 -0400 ++++ xpdf-3.04/xpdf-korean/add-to-xpdfrc 2014-05-29 14:53:15.345783515 -0400 +@@ -1,8 +1,8 @@ + #----- begin Korean support package (2011-sep-02) +-cidToUnicode Adobe-Korea1 /usr/local/share/xpdf/korean/Adobe-Korea1.cidToUnicode +-unicodeMap ISO-2022-KR /usr/local/share/xpdf/korean/ISO-2022-KR.unicodeMap +-cMapDir Adobe-Korea1 /usr/local/share/xpdf/korean/CMap +-toUnicodeDir /usr/local/share/xpdf/korean/CMap ++cidToUnicode Adobe-Korea1 /usr/share/xpdf/korean/Adobe-Korea1.cidToUnicode ++unicodeMap ISO-2022-KR /usr/share/xpdf/korean/ISO-2022-KR.unicodeMap ++cMapDir Adobe-Korea1 /usr/share/xpdf/korean/CMap ++toUnicodeDir /usr/share/xpdf/korean/CMap + #fontFileCC Adobe-Korea1 /usr/..../batang.ttf" + #fontFileCC Unidocs-Korea1 /usr/..../batang.ttf" + #----- end Korean support package +diff -up xpdf-3.04/xpdf-thai/add-to-xpdfrc.orig xpdf-3.04/xpdf-thai/add-to-xpdfrc +--- xpdf-3.04/xpdf-thai/add-to-xpdfrc.orig 2014-05-29 14:50:23.703974490 -0400 ++++ xpdf-3.04/xpdf-thai/add-to-xpdfrc 2014-05-29 14:53:15.355783445 -0400 +@@ -1,4 +1,4 @@ + #----- begin Thai support package (2011-aug-15) +-nameToUnicode /usr/local/share/xpdf/thai/Thai.nameToUnicode +-unicodeMap TIS-620 /usr/local/share/xpdf/thai/TIS-620.unicodeMap ++nameToUnicode /usr/share/xpdf/thai/Thai.nameToUnicode ++unicodeMap TIS-620 /usr/share/xpdf/thai/TIS-620.unicodeMap + #----- end Thai support package diff --git a/xpdf.desktop b/xpdf.desktop index a035510..8cd4dd9 100644 --- a/xpdf.desktop +++ b/xpdf.desktop @@ -1,6 +1,5 @@ [Desktop Entry] -Encoding=UTF-8 -Categories=Application;Graphics; +Categories=Graphics; X-Desktop-File-Install-Version=0.2 Name=Xpdf PDF Viewer Name[sv]=Xpdf PDF-visare @@ -8,8 +7,8 @@ Name[de]=Xpdf PDF-Betrachter Comment=View Adobe PDF (acrobat) files Comment[sv]=Visar Adobe PDF-filer (acrobat-filer) Comment[de]=PDF-Betrachter -Exec=xpdf -Terminal=0 +Exec=xpdf %f +Terminal=false Type=Application -Icon=xpdf.png -MimeType=application/pdf +Icon=xpdf +MimeType=application/pdf; diff --git a/xpdf.spec b/xpdf.spec index 429d9ec..a7541d9 100644 --- a/xpdf.spec +++ b/xpdf.spec @@ -1,56 +1,70 @@ Summary: A PDF file viewer for the X Window System Name: xpdf -Version: 3.01 -Release: 27%{?dist} -License: GPL +Version: 3.04 +Release: 6%{?dist} +License: GPLv2 or GPLv3 Epoch: 1 Url: http://www.foolabs.com/xpdf/ Group: Applications/Publishing -# There are some troublesome files named vms_*. We pull them out of the -# tarball since we're not even using them on Linux. -# Source0: ftp://ftp.foolabs.com/pub/xpdf/%{name}-%{version}.tar.gz -Source0: %{name}-%{version}-novms.tar.gz +Source0: ftp://ftp.foolabs.com/pub/xpdf/%{name}-%{version}.tar.gz # We have to pull the CMap files out due to non-free license. -# Source3: ftp://ftp.foolabs.com/pub/xpdf/xpdf-chinese-simplified-2004-jul-27.tar.gz -Source3: xpdf-chinese-simplified-2004-jul-27-NOCMAP.tar.gz -# Source4: ftp://ftp.foolabs.com/pub/xpdf/xpdf-chinese-traditional-2004-jul-27.tar.gz -Source4: xpdf-chinese-traditional-2004-jul-27-NOCMAP.tar.gz -# Source5: ftp://ftp.foolabs.com/pub/xpdf/xpdf-japanese-2004-jul-27.tar.gz -Source5: xpdf-japanese-2004-jul-27-NOCMAP.tar.gz -# Source6: ftp://ftp.foolabs.com/pub/xpdf/xpdf-korean-2005-jul-07.tar.gz -Source6: xpdf-korean-2005-jul-07-NOCMAP.tar.gz +# Source3: ftp://ftp.foolabs.com/pub/xpdf/xpdf-chinese-simplified-2011-sep-02.tar.gz +Source3: xpdf-chinese-simplified-2011-sep-02-NOCMAP.tar.gz +# Source4: ftp://ftp.foolabs.com/pub/xpdf/xpdf-chinese-traditional-2011-sep-02.tar.gz +Source4: xpdf-chinese-traditional-2011-sep-02-NOCMAP.tar.gz +# Source5: ftp://ftp.foolabs.com/pub/xpdf/xpdf-japanese-2011-sep-02.tar.gz +Source5: xpdf-japanese-2011-sep-02-NOCMAP.tar.gz +# Source6: ftp://ftp.foolabs.com/pub/xpdf/xpdf-korean-2011-sep-02.tar.gz +Source6: xpdf-korean-2011-sep-02-NOCMAP.tar.gz # cyrillic and thai don't have CMap files to worry about. -Source7: ftp://ftp.foolabs.com/pub/xpdf/xpdf-cyrillic-2003-jun-28.tar.gz -Source8: ftp://ftp.foolabs.com/pub/xpdf/xpdf-thai-2002-jan-16.tar.gz +Source7: ftp://ftp.foolabs.com/pub/xpdf/xpdf-cyrillic-2011-aug-15.tar.gz +Source8: ftp://ftp.foolabs.com/pub/xpdf/xpdf-thai-2011-aug-15.tar.gz Source10: xpdf.desktop Source11: xpdf.png +Source12: ftp://ftp.foolabs.com/pub/xpdf/xpdf-arabic-2011-aug-15.tar.gz +Source13: ftp://ftp.foolabs.com/pub/xpdf/xpdf-greek-2011-aug-15.tar.gz +Source14: ftp://ftp.foolabs.com/pub/xpdf/xpdf-hebrew-2011-aug-15.tar.gz +Source15: ftp://ftp.foolabs.com/pub/xpdf/xpdf-latin2-2011-aug-15.tar.gz +Source16: ftp://ftp.foolabs.com/pub/xpdf/xpdf-turkish-2011-aug-15.tar.gz -Patch0: xpdf-3.01-redhat-new.patch -Patch3: xpdf-2.02-ext.patch +Patch0: xpdf-3.04-redhat-new.patch +Patch3: xpdf-3.03-ext.patch Patch6: xpdf-3.00-core.patch Patch7: xpdf-3.00-xfont.patch Patch9: xpdf-3.00-papersize.patch -Patch10: xpdf-3.00-gcc4.patch -Patch11: xpdf-3.01-crash.patch -Patch12: xpdf-3.00-64bit.patch -Patch13: xpdf-3.01-resize.patch -Patch14: xpdf-3.01-freetype-internals.patch -Patch15: xpdf-3.01-nocmap.patch +Patch11: xpdf-3.04-crash.patch +Patch12: xpdf-3.04-64bit.patch +Patch15: xpdf-3.04-nocmap.patch +Patch16: xpdf-3.02-fontlist.patch +Patch19: xpdf-3.02-additionalzoom.patch +Patch20: xpdf-3.04-pdftopng.patch +Patch21: xpdf-3.04-localized.patch # Security patches -# xpdf-3.01-CVE-2005-3191, CAN-2005-3193, CVE-2006-0301 -Patch100: xpdf-3.01pl2.patch + +# Debian patches +Patch200: 02_permissions.dpatch +Patch201: 10_add_accelerators.dpatch +# Proper stream encoding on 64bit platforms +Patch203: fix-444648.dpatch Requires: urw-fonts -Requires: htmlview -Requires: xpdf-utils +Requires: xdg-utils +Requires: poppler-utils +Requires: xorg-x11-fonts-ISO8859-1-75dpi +Requires: xorg-x11-fonts-ISO8859-1-100dpi -BuildRequires: lesstif-devel +%if 0%{?rhel} +BuildRequires: openmotif-devel +%else +# Used to use lesstif-devel here. If you are trying to build on Fedora < 17, try that. +BuildRequires: motif-devel +%endif BuildRequires: freetype-devel >= 2.1.7 BuildRequires: desktop-file-utils -BuildRequires: t1lib-devel BuildRequires: libpaper-devel +BuildRequires: libpng-devel Provides: %{name}-chinese-simplified = %{version}-%{release} Obsoletes: %{name}-chinese-simplified @@ -69,21 +83,26 @@ Xpdf is an X Window System based viewer for Portable Document Format standard X fonts. %prep -%setup -q -a 3 -a 4 -a 5 -a 6 -a 7 -a 8 -%patch -p1 +%setup -q -a 3 -a 4 -a 5 -a 6 -a 7 -a 8 -a 12 -a 13 -a 14 -a 15 -a 16 +%patch0 -p1 %patch3 -p1 -b .ext %patch6 -p1 -b .core %patch7 -p1 -b .fonts %patch9 -p1 -b .papersize -%patch10 -p1 -b .gcc4 %patch11 -p1 -b .crash %patch12 -p1 -b .alloc -%patch13 -p1 -b .resize -%patch14 -p1 -b .freetype-internals -%patch15 -p1 -b .nocmap +%patch15 -p1 +%patch16 -p1 -b .fontlist +%patch19 -p1 +%patch20 -p1 -b .pdftopng +%patch21 -p1 -b .localized # security patches -%patch100 -p1 -b .CVE-2005-3191_CAN-2005-3193_CVE-2006-0301 + +# debian patches +%patch200 -p1 -b .permissions +%patch201 -p1 -b .accelerators +%patch203 -p1 -b .64bit-stream %build find -name "*orig" | xargs rm -f @@ -95,6 +114,7 @@ done # Same action for _datadir. for file in xpdf-*/README xpdf-*/add-to-xpdfrc; do sed -i -e 's:/usr/share/:%{_datadir}/:g' $file + sed -i -e 's:/usr/local/share/:%{_datadir}/:g' $file done %configure \ @@ -105,7 +125,6 @@ done --enable-opi \ --with-appdef-dir=%{_datadir}/X11/app-defaults/ \ --without-Xp-library \ - --with-t1-library \ --with-freetype2-library=%{_libdir} \ --with-freetype2-includes=%{_includedir}/freetype2 @@ -113,57 +132,82 @@ make %{?_smp_mflags} make xpdf %{?_smp_mflags} %install -rm -rf $RPM_BUILD_ROOT - -mkdir -p $RPM_BUILD_ROOT%{_datadir}/xpdf/chinese-simplified \ +mkdir -p $RPM_BUILD_ROOT%{_datadir}/xpdf/arabic \ + $RPM_BUILD_ROOT%{_datadir}/xpdf/chinese-simplified \ $RPM_BUILD_ROOT%{_datadir}/xpdf/chinese-traditional \ $RPM_BUILD_ROOT%{_datadir}/xpdf/cyrillic \ + $RPM_BUILD_ROOT%{_datadir}/xpdf/greek \ + $RPM_BUILD_ROOT%{_datadir}/xpdf/hebrew \ $RPM_BUILD_ROOT%{_datadir}/xpdf/japanese \ $RPM_BUILD_ROOT%{_datadir}/xpdf/korean \ + $RPM_BUILD_ROOT%{_datadir}/xpdf/latin2 \ $RPM_BUILD_ROOT%{_datadir}/xpdf/thai \ + $RPM_BUILD_ROOT%{_datadir}/xpdf/turkish \ $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps make install DESTDIR=$RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications/ +%if 0%{?rhel} > 5 || 0%{?fedora} +desktop-file-install \ +%else desktop-file-install --vendor "fedora" \ +%endif --dir $RPM_BUILD_ROOT%{_datadir}/applications \ --add-category X-Fedora \ %{SOURCE10} install -m 0644 %{SOURCE11} $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps/xpdf.png +cp -pr xpdf-arabic/* $RPM_BUILD_ROOT%{_datadir}/xpdf/arabic/ cp -pr xpdf-chinese-simplified/* $RPM_BUILD_ROOT%{_datadir}/xpdf/chinese-simplified/ cp -pr xpdf-chinese-traditional/* $RPM_BUILD_ROOT%{_datadir}/xpdf/chinese-traditional/ cp -pr xpdf-cyrillic/* $RPM_BUILD_ROOT%{_datadir}/xpdf/cyrillic/ +cp -pr xpdf-greek/* $RPM_BUILD_ROOT%{_datadir}/xpdf/greek/ +cp -pr xpdf-hebrew/* $RPM_BUILD_ROOT%{_datadir}/xpdf/hebrew/ cp -pr xpdf-japanese/* $RPM_BUILD_ROOT%{_datadir}/xpdf/japanese/ cp -pr xpdf-korean/* $RPM_BUILD_ROOT%{_datadir}/xpdf/korean/ +cp -pr xpdf-latin2/* $RPM_BUILD_ROOT%{_datadir}/xpdf/latin2/ cp -pr xpdf-thai/* $RPM_BUILD_ROOT%{_datadir}/xpdf/thai/ +cp -pr xpdf-turkish/* $RPM_BUILD_ROOT%{_datadir}/xpdf/turkish/ # poppler provides all utilities now # http://bugzilla.redhat.com/bugzillA/SHow_bug.cgi?id=177446 # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=219032 +%if 0%{?fedora} +rm $RPM_BUILD_ROOT%{_bindir}/pdfdetach +%endif rm $RPM_BUILD_ROOT%{_bindir}/pdffonts rm $RPM_BUILD_ROOT%{_bindir}/pdfimages rm $RPM_BUILD_ROOT%{_bindir}/pdfinfo rm $RPM_BUILD_ROOT%{_bindir}/pdftops rm $RPM_BUILD_ROOT%{_bindir}/pdftotext +%if 0%{?rhel} > 5 || 0%{?fedora} > 6 rm $RPM_BUILD_ROOT%{_bindir}/pdftoppm - +rm $RPM_BUILD_ROOT%{_mandir}/man1/pdftoppm.1* +%endif +%if 0%{?fedora} +rm $RPM_BUILD_ROOT%{_mandir}/man1/pdfdetach.1* +%endif rm $RPM_BUILD_ROOT%{_mandir}/man1/pdffonts.1* rm $RPM_BUILD_ROOT%{_mandir}/man1/pdfimages.1* rm $RPM_BUILD_ROOT%{_mandir}/man1/pdfinfo.1* rm $RPM_BUILD_ROOT%{_mandir}/man1/pdftops.1* rm $RPM_BUILD_ROOT%{_mandir}/man1/pdftotext.1* -rm $RPM_BUILD_ROOT%{_mandir}/man1/pdftoppm.1* mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xpdf/ -for i in chinese-simplified chinese-traditional cyrillic japanese korean thai; do +for i in arabic chinese-simplified chinese-traditional cyrillic greek hebrew japanese korean latin2 thai turkish; do mv $RPM_BUILD_ROOT%{_datadir}/%{name}/$i/README README.$i mv $RPM_BUILD_ROOT%{_datadir}/%{name}/$i/add-to-xpdfrc $RPM_BUILD_ROOT%{_sysconfdir}/xpdf/add-to-xpdfrc.$i done -%clean -rm -rf $RPM_BUILD_ROOT +# xpdfrc cleanup +sed -i -e 's:/usr/local/share/:%{_datadir}/:g' $RPM_BUILD_ROOT%{_sysconfdir}/xpdfrc + +# CJK are already in the file +for i in arabic cyrillic greek hebrew latin2 thai turkish; do + echo "# $i" >> $RPM_BUILD_ROOT%{_sysconfdir}/xpdfrc + echo "include %{_sysconfdir}/xpdf/add-to-xpdfrc.$i" >> $RPM_BUILD_ROOT%{_sysconfdir}/xpdfrc +done %post touch --no-create %{_datadir}/icons/hicolor || : @@ -176,30 +220,170 @@ touch --no-create %{_datadir}/icons/hicolor || : update-desktop-database &> /dev/null ||: %files -%defattr(-,root,root) %doc CHANGES README README.* %{_bindir}/xpdf +%{_bindir}/pdftopng +%{_mandir}/man?/pdftopng* %{_mandir}/man?/xpdf* +%if 0%{?rhel} > 5 || 0%{?fedora} > 6 +# Do Nothing. +%else +%{_bindir}/pdftoppm +%{_mandir}/man?/pdftoppm* +%endif +%if 0%{?rhel} +%{_bindir}/pdfdetach +%{_mandir}/man?/pdfdetach* +%endif %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/xpdfrc %dir %{_sysconfdir}/xpdf +%lang(ar) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/xpdf/add-to-xpdfrc.arabic %lang(zh_CN) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/xpdf/add-to-xpdfrc.chinese-simplified %lang(zh_TW) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/xpdf/add-to-xpdfrc.chinese-traditional +%lang(el) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/xpdf/add-to-xpdfrc.greek +%lang(iw) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/xpdf/add-to-xpdfrc.hebrew %lang(ja) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/xpdf/add-to-xpdfrc.japanese %lang(ko) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/xpdf/add-to-xpdfrc.korean %lang(th) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/xpdf/add-to-xpdfrc.thai -# cyrillic is not a lang, many languages are cyrillic +%lang(tr) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/xpdf/add-to-xpdfrc.turkish +# cyrillic and latin2 are not langs, many languages are cyrillic/latin2 %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/xpdf/add-to-xpdfrc.cyrillic +%config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/xpdf/add-to-xpdfrc.latin2 %{_datadir}/icons/hicolor/48x48/apps/xpdf.png %dir %{_datadir}/xpdf %{_datadir}/applications/* +%lang(ar) %{_datadir}/xpdf/arabic %lang(zh_CN) %{_datadir}/xpdf/chinese-simplified %lang(zh_TW) %{_datadir}/xpdf/chinese-traditional +%lang(el) %{_datadir}/xpdf/greek +%lang(iw) %{_datadir}/xpdf/hebrew %lang(ja) %{_datadir}/xpdf/japanese %lang(ko) %{_datadir}/xpdf/korean %lang(th) %{_datadir}/xpdf/thai +%lang(tr) %{_datadir}/xpdf/turkish %{_datadir}/xpdf/cyrillic +%{_datadir}/xpdf/latin2 %changelog +* Tue Dec 2 2014 Tom Callaway - 1:3.04-6 +- fix proper display of international strings in the title (bz 1169301) + +* Fri Sep 12 2014 Tom Callaway - 1:3.04-5 +- fix .desktop file + +* Mon Aug 18 2014 Fedora Release Engineering - 1:3.04-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sun Jun 08 2014 Fedora Release Engineering - 1:3.04-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Tue Jun 3 2014 Tom Callaway - 1:3.04-2 +- fix "sharexpdf" typo in lang configs + +* Thu May 29 2014 Tom Callaway - 1:3.04-1 +- update to 3.04 +- update all patches, langpacks +- use motif instead of lesstif where possible +- fix pdftopng to install (not in poppler right now) + +* Sun Sep 22 2013 Tom Callaway - 1:3.03-8.1 +- rhel still needs pdfdetach in xpdf + +* Sun Sep 22 2013 Tom Callaway - 1:3.03-8 +- fix CVE-2012-2142 +- fix issue with icon name in .desktop file (except on el5) + +* Sun Aug 04 2013 Fedora Release Engineering - 1:3.03-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Sun Feb 10 2013 Parag Nemade - 1:3.03-6 +- Remove vendor tag from desktop file as per https://fedorahosted.org/fesco/ticket/1077 + +* Wed Nov 14 2012 Tom Callaway - 1:3.03-5 +- fix desktop file to invoke xpdf with a file param (bz874644) + +* Sun Jul 22 2012 Fedora Release Engineering - 1:3.03-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Fri May 25 2012 Tom Callaway - 1:3.03-3 +- drop pdfdetach, poppler-utils has it now + +* Sat Jan 14 2012 Fedora Release Engineering - 1:3.03-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Mon Aug 22 2011 Tom Callaway - 1:3.03-1 +- update to 3.03 + +* Tue Feb 08 2011 Fedora Release Engineering - 1:3.02-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Fri Jan 21 2011 Tom Callaway - 1:3.02-17 +- Added pdftoppm for el5 or older, since it is not included in poppler-utils on el5 +- Thanks to Ingvar Hagelund. + +* Fri Oct 22 2010 Tom "spot" Callaway - 1:3.02-16 +- apply xpdf-3.02pl5 security patch to fix: + CVE-2010-3702, CVS-2010-3704 + +* Fri Oct 16 2009 Tom "spot" Callaway - 1:3.02-15 +- apply xpdf-3.02pl4 security patch to fix: + CVE-2009-3603, CVE-2009-3604, CVE-2009-3605, CVE-2009-3606 + CVE-2009-3608, CVE-2009-3609 + +* Mon Jul 27 2009 Fedora Release Engineering - 1:3.02-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Thu Apr 16 2009 Tom "spot" Callaway - 1:3.02-13 +- apply xpdf-3.02pl3 security patch to fix: + CVE-2009-0799, CVE-2009-0800, CVE-2009-1179, CVE-2009-1180 + CVE-2009-1181, CVE-2009-1182, CVE-2009-1183 + +* Wed Mar 4 2009 Tom "spot" Callaway - 1:3.02-12 +- add Requires: xorg-x11-fonts-ISO8859-1-100dpi (bz 485404) + +* Thu Feb 26 2009 Fedora Release Engineering - 1:3.02-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Wed Feb 11 2009 Tom "spot" Callaway - 1:3.02-10 +- cleanup crash patch a bit (bz 483664) +- improve support for more mouse buttons (bz 483669) + +* Wed Dec 10 2008 Tom "spot" Callaway - 1:3.02-9 +- apply debian patches + +* Sun Sep 21 2008 Ville Skyttä - 1:3.02-8 +- Fix Patch0:/%%patch mismatch. + +* Thu Jun 19 2008 Tom "spot" Callaway 1:3.02-7 +- add missing Requires: xorg-x11-fonts-ISO8859-1-75dpi + +* Tue Feb 19 2008 Fedora Release Engineering - 1:3.02-6 +- Autorebuild for GCC 4.3 + +* Wed Jan 2 2008 Tom "spot" Callaway 1:3.02-5 +- use xdg-utils instead of htmlview (bz 313311) + +* Fri Nov 9 2007 Tom "spot" Callaway 1:3.02-4 +- resolve 372461, 372471, 372481 + +* Tue Aug 28 2007 Tom "spot" Callaway 1:3.02-3 +- fix PDF printing on x86_64 (bz 253601) +- add mouse buttons 8 and 9 (bz 255401) +- add extra zoom types (bz 251855) +- rebuild for BuildID + +* Mon Aug 6 2007 Tom "spot" Callaway 1:3.02-2 +- fix font list parsing to squelch noise (bz 250709) +- cleanup add-to-xpdfrc files, update xpdfrc to include them by default + +* Wed Aug 1 2007 Tom "spot" Callaway 1:3.02-1 +- bump to 3.02 +- patch in security fix +- add arabic, greek, hebrew, latin2, turkish lang support + +* Mon Dec 18 2006 Tom "spot" Callaway 1:3.01-28 +- Requires: poppler-utils + * Thu Dec 14 2006 Tom "spot" Callaway 1:3.01-27 - drop the xpdf-utils subpackage, poppler-utils ate it all @@ -492,7 +676,7 @@ update-desktop-database &> /dev/null ||: * Sun Mar 17 2002 Than Ngo 1.00-3 - rebuild -* Wed Feb 21 2002 Than Ngo 1.00-2 +* Thu Feb 21 2002 Than Ngo 1.00-2 - fix Bad 'urlCommand' (bug #59730) * Tue Feb 05 2002 Than Ngo 1.00-1 @@ -547,7 +731,7 @@ update-desktop-database &> /dev/null ||: * Thu Jul 13 2000 Prospector - automatic rebuild -* Tue Jul 2 2000 Jakub Jelinek +* Sun Jul 2 2000 Jakub Jelinek - Rebuild with new C++ * Fri Jun 16 2000 Than Ngo