spot pushed to xpdf (epel7). "initial epel7 package"
notifications at fedoraproject.org
notifications at fedoraproject.org
Mon Apr 13 15:15:59 UTC 2015
>From 0e002320df7771f383bc99d0c0c88e0f4cf727da Mon Sep 17 00:00:00 2001
From: Tom Callaway <spot at fedoraproject.org>
Date: Mon, 13 Apr 2015 11:15:39 -0400
Subject: initial epel7 package
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 <aconf.h>
+@@ -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 <aconf.h>
+@@ -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 <aconf.h>
+@@ -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 <aconf.h>
+@@ -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 <aconf.h>
+@@ -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 <aconf.h>
+@@ -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 <hamish at noddy.cloud.net.au>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Add keyboard accelerators for rotate (#385962)
+
+ at 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 <arenevier at fdn.fr>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix segmentation fault when pressing Ctrl-W in full screen mode
+
+ at 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 <brlink at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Do proper PS stream encoding on 64 bit architectures
+
+ at 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 <jpalecek at web.de>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix segmentation fault in image handling
+
+ at 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 <s-beyer at gmx.net>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix segmentation fault when pressing g in full screen mode
+
+ at 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 e69de29..75f71be 100644
--- a/sources
+++ b/sources
@@ -0,0 +1,12 @@
+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-2.02-ext.patch b/xpdf-2.02-ext.patch
new file mode 100644
index 0000000..9126dc4
--- /dev/null
+++ b/xpdf-2.02-ext.patch
@@ -0,0 +1,50 @@
+--- xpdf-2.02/goo/gfile.cc.orig 2003-03-31 16:45:50.000000000 +0200
++++ xpdf-2.02/goo/gfile.cc 2003-03-31 17:09:19.000000000 +0200
+@@ -486,32 +486,14 @@
+ 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;
+@@ -519,7 +501,7 @@
+ *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;
+ return gFalse;
diff --git a/xpdf-3.00-64bit.patch b/xpdf-3.00-64bit.patch
new file mode 100644
index 0000000..a9a4d43
--- /dev/null
+++ b/xpdf-3.00-64bit.patch
@@ -0,0 +1,57 @@
+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) 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) {
+ 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;
+ 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 <p> 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.00-core.patch b/xpdf-3.00-core.patch
new file mode 100644
index 0000000..21e6148
--- /dev/null
+++ b/xpdf-3.00-core.patch
@@ -0,0 +1,13 @@
+--- xpdf-3.00/xpdf/XPDFCore.cc.ud 2004-10-07 12:44:23.000000000 -0700
++++ xpdf-3.00/xpdf/XPDFCore.cc 2004-10-07 12:44:26.000000000 -0700
+@@ -1051,6 +1051,10 @@
+ GString *msg;
+ int i;
+
++ if (action == NULL)
++ // Nothing to do.
++ return;
++
+ switch (kind = action->getKind()) {
+
+ // GoTo / GoToR action
diff --git a/xpdf-3.00-gcc4.patch b/xpdf-3.00-gcc4.patch
new file mode 100644
index 0000000..494b127
--- /dev/null
+++ b/xpdf-3.00-gcc4.patch
@@ -0,0 +1,29 @@
+--- xpdf-3.00/xpdf/TextOutputDev.h.orig 2005-06-13 10:11:17.000000000 +0200
++++ xpdf-3.00/xpdf/TextOutputDev.h 2005-06-13 10:27:18.000000000 +0200
+@@ -169,7 +169,7 @@
+ class TextLine {
+ public:
+
+- TextLine(TextBlock *blkA, int rotA, double baseA);
++ TextLine(class TextBlock *blkA, int rotA, double baseA);
+ ~TextLine();
+
+ void addWord(TextWord *word);
+@@ -226,7 +226,7 @@
+ class TextBlock {
+ public:
+
+- TextBlock(TextPage *pageA, int rotA);
++ TextBlock(class TextPage *pageA, int rotA);
+ ~TextBlock();
+
+ void addWord(TextWord *word);
+@@ -416,7 +416,7 @@
+ private:
+
+ void clear();
+- void assignColumns(TextLineFrag *frags, int nFrags, int rot);
++ void assignColumns(class TextLineFrag *frags, int nFrags, int rot);
+ int dumpFragment(Unicode *text, int len, UnicodeMap *uMap, GString *s);
+
+ GBool rawOrder; // keep text in content stream order
diff --git a/xpdf-3.00-papersize.patch b/xpdf-3.00-papersize.patch
new file mode 100644
index 0000000..f36dc06
--- /dev/null
+++ b/xpdf-3.00-papersize.patch
@@ -0,0 +1,13 @@
+--- xpdf-3.00/xpdf/config.h.orig 2004-11-29 17:14:12.583102885 +0100
++++ xpdf-3.00/xpdf/config.h 2004-11-29 17:14:54.312235643 +0100
+@@ -41,8 +41,8 @@
+ #define defPaperWidth 595 // ISO A4 (210x297 mm)
+ #define defPaperHeight 842
+ #else
+-#define defPaperWidth 612 // American letter (8.5x11")
+-#define defPaperHeight 792
++#define defPaperWidth -1 // match
++#define defPaperHeight -1
+ #endif
+
+ //------------------------------------------------------------------------
diff --git a/xpdf-3.00-xfont.patch b/xpdf-3.00-xfont.patch
new file mode 100644
index 0000000..50dcec2
--- /dev/null
+++ b/xpdf-3.00-xfont.patch
@@ -0,0 +1,11 @@
+--- xpdf-3.00/xpdf/XPDFViewer.cc.orig 2004-10-12 12:24:57.055068037 +0200
++++ xpdf-3.00/xpdf/XPDFViewer.cc 2004-10-12 12:24:47.707449614 +0200
+@@ -1742,7 +1742,7 @@
+ aboutBigFont =
+ createFontList("-*-times-bold-i-normal--20-*-*-*-*-*-iso8859-1");
+ aboutVersionFont =
+- createFontList("-*-times-medium-r-normal--16-*-*-*-*-*-iso8859-1");
++ createFontList("-*-times-medium-r-normal--14-*-*-*-*-*-iso8859-1");
+ aboutFixedFont =
+ createFontList("-*-courier-medium-r-normal--12-*-*-*-*-*-iso8859-1");
+
diff --git a/xpdf-3.01-crash.patch b/xpdf-3.01-crash.patch
new file mode 100644
index 0000000..21e60b3
--- /dev/null
+++ b/xpdf-3.01-crash.patch
@@ -0,0 +1,34 @@
+--- xpdf-3.00/splash/Splash.cc.tn 2005-07-25 09:59:45.000000000 +0200
++++ xpdf-3.00/splash/Splash.cc 2005-07-25 10:00:58.000000000 +0200
+@@ -636,6 +641,11 @@
+
+ xPath = new SplashXPath(path, 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
+--- xpdf-3.00/fofi/FoFiType1.cc.tn 2005-07-25 10:34:04.000000000 +0200
++++ xpdf-3.00/fofi/FoFiType1.cc 2005-07-25 10:41:37.000000000 +0200
+@@ -187,9 +187,14 @@
+ }
+ }
+ } 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;
+ }
+ }
+ line = line1;
diff --git a/xpdf-3.01-freetype-internals.patch b/xpdf-3.01-freetype-internals.patch
new file mode 100644
index 0000000..05bb92b
--- /dev/null
+++ b/xpdf-3.01-freetype-internals.patch
@@ -0,0 +1,77 @@
+--- xpdf-3.01/splash/SplashFTFont.cc.orig 2006-07-14 10:55:18.000000000 +0200
++++ xpdf-3.01/splash/SplashFTFont.cc 2006-07-14 10:55:25.000000000 +0200
+@@ -14,7 +14,8 @@
+
+ #include <ft2build.h>
+ #include FT_OUTLINE_H
+-#include FT_INTERNAL_OBJECTS_H // needed for FT_New_Size decl
++#include FT_SIZES_H // needed for FT_New_Size decl
++#include FT_GLYPH_H
+ #include "gmem.h"
+ #include "SplashMath.h"
+ #include "SplashGlyphBitmap.h"
+@@ -25,11 +26,12 @@
+
+ //------------------------------------------------------------------------
+
+-static int glyphPathMoveTo(FT_Vector *pt, void *path);
+-static int glyphPathLineTo(FT_Vector *pt, void *path);
+-static int glyphPathConicTo(FT_Vector *ctrl, FT_Vector *pt, void *path);
+-static int glyphPathCubicTo(FT_Vector *ctrl1, FT_Vector *ctrl2,
+- FT_Vector *pt, void *path);
++static int glyphPathMoveTo( const FT_Vector *pt, void *path);
++static int glyphPathLineTo( const FT_Vector *pt, void *path);
++static int glyphPathConicTo( const FT_Vector *ctrl, const FT_Vector *pt,
++ void* path );
++static int glyphPathCubicTo( const FT_Vector *ctrl1, const FT_Vector *ctrl2,
++ const FT_Vector *pt, void *path);
+
+ //------------------------------------------------------------------------
+ // SplashFTFont
+@@ -210,7 +212,7 @@
+ };
+
+ SplashPath *SplashFTFont::getGlyphPath(int c) {
+- static FT_Outline_Funcs outlineFuncs = {
++ static const FT_Outline_Funcs outlineFuncs = {
+ &glyphPathMoveTo,
+ &glyphPathLineTo,
+ &glyphPathConicTo,
+@@ -249,7 +251,7 @@
+ return path.path;
+ }
+
+-static int glyphPathMoveTo(FT_Vector *pt, void *path) {
++static int glyphPathMoveTo( const FT_Vector *pt, void *path) {
+ SplashFTFontPath *p = (SplashFTFontPath *)path;
+
+ if (p->needClose) {
+@@ -260,7 +262,7 @@
+ return 0;
+ }
+
+-static int glyphPathLineTo(FT_Vector *pt, void *path) {
++static int glyphPathLineTo(const FT_Vector *pt, void *path) {
+ SplashFTFontPath *p = (SplashFTFontPath *)path;
+
+ p->path->lineTo(pt->x / 64.0, -pt->y / 64.0);
+@@ -268,7 +270,7 @@
+ return 0;
+ }
+
+-static int glyphPathConicTo(FT_Vector *ctrl, FT_Vector *pt, void *path) {
++static int glyphPathConicTo(const FT_Vector *ctrl, const FT_Vector *pt, void *path) {
+ SplashFTFontPath *p = (SplashFTFontPath *)path;
+ SplashCoord x0, y0, x1, y1, x2, y2, x3, y3, xc, yc;
+
+@@ -306,8 +308,8 @@
+ return 0;
+ }
+
+-static int glyphPathCubicTo(FT_Vector *ctrl1, FT_Vector *ctrl2,
+- FT_Vector *pt, void *path) {
++static int glyphPathCubicTo(const FT_Vector *ctrl1, const FT_Vector *ctrl2,
++ const FT_Vector *pt, void *path) {
+ SplashFTFontPath *p = (SplashFTFontPath *)path;
+
+ p->path->curveTo(ctrl1->x / 64.0, -ctrl1->y / 64.0,
diff --git a/xpdf-3.01-nocmap.patch b/xpdf-3.01-nocmap.patch
new file mode 100644
index 0000000..336f82d
--- /dev/null
+++ b/xpdf-3.01-nocmap.patch
@@ -0,0 +1,49 @@
+--- xpdf-3.01/xpdf-chinese-traditional/add-to-xpdfrc.NOCMAP 2006-09-25 15:26:58.000000000 -0500
++++ xpdf-3.01/xpdf-chinese-traditional/add-to-xpdfrc 2006-09-25 15:27:04.000000000 -0500
+@@ -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
+ #displayCIDFontTT Adobe-CNS1 /usr/..../bkai00mp.ttf
+ #----- end Chinese Traditional support package
+--- xpdf-3.01/xpdf-korean/add-to-xpdfrc.NOCMAP 2006-09-25 15:27:33.000000000 -0500
++++ xpdf-3.01/xpdf-korean/add-to-xpdfrc 2006-09-25 15:27:48.000000000 -0500
+@@ -1,8 +1,8 @@
+ #----- begin Korean support package (2005-jul-07)
+ 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
+ #displayCIDFontTT Adobe-Korea1 /usr/..../batang.ttf"
+ #displayCIDFontTT Unidocs-Korea1 /usr/..../batang.ttf"
+ #----- end Korean support package
+--- xpdf-3.01/xpdf-chinese-simplified/add-to-xpdfrc.NOCMAP 2006-09-25 15:26:43.000000000 -0500
++++ xpdf-3.01/xpdf-chinese-simplified/add-to-xpdfrc 2006-09-25 15:26:49.000000000 -0500
+@@ -3,7 +3,7 @@ cidToUnicode Adobe-GB1 /usr/share/xpdf/c
+ 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
+ #displayCIDFontTT Adobe-GB1 /usr/..../gkai00mp.ttf
+ #----- end Chinese Simplified support package
+--- xpdf-3.01/xpdf-japanese/add-to-xpdfrc.NOCMAP 2006-09-25 15:27:16.000000000 -0500
++++ xpdf-3.01/xpdf-japanese/add-to-xpdfrc 2006-09-25 15:27:20.000000000 -0500
+@@ -3,7 +3,7 @@ cidToUnicode Adobe-Japan1 /usr/share/xpd
+ 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
+ #displayCIDFontTT Adobe-Japan1 /usr/..../kochi-mincho.ttf
+ #----- end Japanese support package
diff --git a/xpdf-3.01-redhat-new.patch b/xpdf-3.01-redhat-new.patch
new file mode 100644
index 0000000..2a1e0ca
--- /dev/null
+++ b/xpdf-3.01-redhat-new.patch
@@ -0,0 +1,258 @@
+--- xpdf-3.01/xpdf-chinese-traditional/add-to-xpdfrc.orig 2004-07-27 17:28:07.000000000 -0500
++++ xpdf-3.01/xpdf-chinese-traditional/add-to-xpdfrc 2006-09-25 12:58:50.000000000 -0500
+@@ -1,8 +1,8 @@
+ #----- begin Chinese Traditional support package (2004-jul-27)
+-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
+ #displayCIDFontTT Adobe-CNS1 /usr/..../bkai00mp.ttf
+ #----- end Chinese Traditional support package
+--- xpdf-3.01/xpdf-korean/add-to-xpdfrc.orig 2005-07-07 13:05:05.000000000 -0500
++++ xpdf-3.01/xpdf-korean/add-to-xpdfrc 2006-09-25 12:56:15.000000000 -0500
+@@ -1,8 +1,8 @@
+ #----- begin Korean support package (2005-jul-07)
+-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
+ #displayCIDFontTT Adobe-Korea1 /usr/..../batang.ttf"
+ #displayCIDFontTT Unidocs-Korea1 /usr/..../batang.ttf"
+ #----- end Korean support package
+--- xpdf-3.01/xpdf-chinese-simplified/add-to-xpdfrc.orig 2004-07-27 17:28:08.000000000 -0500
++++ xpdf-3.01/xpdf-chinese-simplified/add-to-xpdfrc 2006-09-25 12:57:18.000000000 -0500
+@@ -1,9 +1,9 @@
+ #----- begin Chinese Simplified support package (2004-jul-27)
+-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
+ #displayCIDFontTT Adobe-GB1 /usr/..../gkai00mp.ttf
+ #----- end Chinese Simplified support package
+--- xpdf-3.01/xpdf-japanese/add-to-xpdfrc.orig 2004-07-27 17:28:07.000000000 -0500
++++ xpdf-3.01/xpdf-japanese/add-to-xpdfrc 2006-09-25 12:58:10.000000000 -0500
+@@ -1,9 +1,9 @@
+ #----- begin Japanese support package (2004-jul-27)
+-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
+ #displayCIDFontTT Adobe-Japan1 /usr/..../kochi-mincho.ttf
+ #----- end Japanese support package
+--- xpdf-3.01/doc/xpdfrc.5.orig 2005-08-17 00:34:30.000000000 -0500
++++ xpdf-3.01/doc/xpdfrc.5 2006-09-25 12:54:53.000000000 -0500
+@@ -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
+@@ -459,7 +459,7 @@ urlCommand "netscape -remote 'openU
+ .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
+--- 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
+ .SH CONFIGURATION FILE
+ Xpdf reads a configuration file at startup. It first tries to find
+ the user's private config file, ~/.xpdfrc. If that doesn't exist, it
+-looks for a system-wide config file, typically /usr/local/etc/xpdfrc
++looks for a system-wide config file, typically /etc/xpdfrc
+ (but this location can be changed when xpdf is built). See the
+ .BR xpdfrc (5)
+ man page for details.
+--- xpdf-3.01/doc/pdfimages.1.orig 2005-08-17 00:34:30.000000000 -0500
++++ xpdf-3.01/doc/pdfimages.1 2006-09-25 12:54:53.000000000 -0500
+@@ -29,7 +29,7 @@ color inversion, etc. done by the PDF co
+ Pdfimages reads a configuration file at startup. It first tries to
+ find the user's private config file, ~/.xpdfrc. If that doesn't
+ exist, it looks for a system-wide config file, typically
+-/usr/local/etc/xpdfrc (but this location can be changed when pdfimages
++/etc/xpdfrc (but this location can be changed when pdfimages
+ is built). See the
+ .BR xpdfrc (5)
+ man page for details.
+--- xpdf-3.01/xpdf-chinese-traditional/README.orig 2006-09-25 13:33:34.000000000 -0500
++++ xpdf-3.01/xpdf-chinese-traditional/README 2006-09-25 13:37:33.000000000 -0500
+@@ -19,13 +19,13 @@ Contents:
+
+ Place all of these files in a directory, typically:
+
+- Unix - /usr/local/share/xpdf/chinese-traditional
++ Unix - /usr/share/xpdf/chinese-traditional
+ Win32 - C:\Program Files\xpdf\chinese-traditional
+
+ Add the contents of the "add-to-xpdfrc" file to your system-wide
+ xpdfrc config file, which is typically:
+
+- Unix - /usr/local/etc/xpdfrc
++ Unix - /etc/xpdfrc
+ Win32 - C:\Program Files\xpdf\xpdfrc
+
+ Alternatively, on Unix systems you can add these lines to your
+--- xpdf-3.01/xpdf-korean/README.orig 2006-09-25 13:34:27.000000000 -0500
++++ xpdf-3.01/xpdf-korean/README 2006-09-25 13:38:26.000000000 -0500
+@@ -18,13 +18,13 @@ Contents:
+
+ Place all of these files in a directory, typically:
+
+- Unix - /usr/local/share/xpdf/korean
++ Unix - /usr/share/xpdf/korean
+ Win32 - C:\Program Files\xpdf\korean
+
+ Add the contents of the "add-to-xpdfrc" file to your system-wide
+ xpdfrc config file, which is typically:
+
+- Unix - /usr/local/etc/xpdfrc
++ Unix - /etc/xpdfrc
+ Win32 - C:\Program Files\Xpdf\xpdfrc
+
+ Alternatively, on Unix systems you can add these lines to your
+--- xpdf-3.01/xpdf-chinese-simplified/README.orig 2006-09-25 13:33:18.000000000 -0500
++++ xpdf-3.01/xpdf-chinese-simplified/README 2006-09-25 13:37:45.000000000 -0500
+@@ -20,13 +20,13 @@ Contents:
+
+ Place all of these files in a directory, typically:
+
+- Unix - /usr/local/share/xpdf/chinese-simplified
++ Unix - /usr/share/xpdf/chinese-simplified
+ Win32 - C:\Program Files\xpdf\chinese-simplified
+
+ Add the contents of the "add-to-xpdfrc" file to your system-wide
+ xpdfrc config file, which is typically:
+
+- Unix - /usr/local/etc/xpdfrc
++ Unix - /etc/xpdfrc
+ Win32 - C:\Program Files\xpdf\xpdfrc
+
+ Alternatively, on Unix systems you can add these lines to your
+--- xpdf-3.01/xpdf-japanese/README.orig 2006-09-25 13:33:47.000000000 -0500
++++ xpdf-3.01/xpdf-japanese/README 2006-09-25 13:38:12.000000000 -0500
+@@ -20,13 +20,13 @@ Contents:
+
+ Place all of these files in a directory, typically:
+
+- Unix - /usr/local/share/xpdf/japanese
++ Unix - /usr/share/xpdf/japanese
+ Win32 - C:\Program Files\xpdf\japanese
+
+ Add the contents of the "add-to-xpdfrc" file to your system-wide
+ xpdfrc config file, which is typically:
+
+- Unix - /usr/local/etc/xpdfrc
++ Unix - /etc/xpdfrc
+ Win32 - C:\Program Files\xpdf\xpdfrc
+
+ Alternatively, on Unix systems you can add these lines to your
+--- xpdf-3.01/xpdf-thai/README.BAD 2006-09-25 15:42:22.000000000 -0500
++++ xpdf-3.01/xpdf-thai/README 2006-09-25 15:42:33.000000000 -0500
+@@ -18,13 +18,13 @@ Contents:
+
+ Place all of these files in a directory, typically:
+
+- Unix - /usr/local/share/xpdf/thai
++ Unix - /usr/share/xpdf/thai
+ Win32 - C:\Program Files\xpdf\thai
+
+ Add the contents of the "add-to-xpdfrc" file to your system-wide
+ xpdfrc config file, which is typically:
+
+- Unix - /usr/local/etc/xpdfrc
++ Unix - /etc/xpdfrc
+ Win32 - C:\Program Files\xpdf\xpdfrc
+
+ Alternatively, on Unix systems you can add these lines to your
+--- xpdf-3.01/xpdf-thai/add-to-xpdfrc.BAD 2006-09-25 15:43:35.000000000 -0500
++++ xpdf-3.01/xpdf-thai/add-to-xpdfrc 2006-09-25 15:43:44.000000000 -0500
+@@ -1,4 +1,4 @@
+ #----- begin Thai support package (2002-jan-16)
+-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
+--- xpdf-3.01/xpdf-cyrillic/README.BAD 2006-09-25 15:42:48.000000000 -0500
++++ xpdf-3.01/xpdf-cyrillic/README 2006-09-25 15:42:59.000000000 -0500
+@@ -18,13 +18,13 @@ Contents:
+
+ Place all of these files in a directory, typically:
+
+- Unix - /usr/local/share/xpdf/cyrillic
++ Unix - /usr/share/xpdf/cyrillic
+ Win32 - C:\Program Files\xpdf\cyrillic
+
+ Add the contents of the "add-to-xpdfrc" file to your system-wide
+ xpdfrc config file, which is typically:
+
+- Unix - /usr/local/etc/xpdfrc
++ Unix - /etc/xpdfrc
+ Win32 - C:\Program Files\xpdf\xpdfrc
+
+ Alternatively, on Unix systems you can add these lines to your
+--- xpdf-3.01/xpdf-cyrillic/add-to-xpdfrc.BAD 2006-09-25 15:43:28.000000000 -0500
++++ xpdf-3.01/xpdf-cyrillic/add-to-xpdfrc 2006-09-25 15:43:11.000000000 -0500
+@@ -1,4 +1,4 @@
+ #----- begin Cyrillic support package (2003-jun-28)
+-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
+--- 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.01-resize.patch b/xpdf-3.01-resize.patch
new file mode 100644
index 0000000..c1240c3
--- /dev/null
+++ b/xpdf-3.01-resize.patch
@@ -0,0 +1,36 @@
+--- xpdf-3.01/xpdf/XPDFCore.cc.resize 2005-10-06 23:40:10.000000000 +0200
++++ xpdf-3.01/xpdf/XPDFCore.cc 2005-10-06 23:40:10.000000000 +0200
+@@ -979,6 +979,9 @@
+ XPDFCore *core = (XPDFCore *)ptr;
+ XEvent event;
+ Widget top;
++ Window rootWin;
++ int x1, y1;
++ Guint w1, h1, bw1, depth1;
+ Arg args[2];
+ int n;
+ Dimension w, h;
+@@ -986,15 +989,20 @@
+
+ // find the top-most widget which has an associated window, and look
+ // for a pending ConfigureNotify in the event queue -- if there is
+- // one, that means we're still resizing, and we want to skip the
+- // current event
++ // one, and it specifies a different width or height, that means
++ // we're still resizing, and we want to skip the current event
+ for (top = core->parentWidget;
+ XtParent(top) && XtWindow(XtParent(top));
+ top = XtParent(top)) ;
+ if (XCheckTypedWindowEvent(core->display, XtWindow(top),
+ ConfigureNotify, &event)) {
+ XPutBackEvent(core->display, &event);
+- return;
++ XGetGeometry(core->display, event.xconfigure.window,
++ &rootWin, &x1, &y1, &w1, &h1, &bw1, &depth1);
++ if ((Guint)event.xconfigure.width != w1 ||
++ (Guint)event.xconfigure.height != h1) {
++ return;
++ }
+ }
+
+ n = 0;
diff --git a/xpdf-3.01pl2.patch b/xpdf-3.01pl2.patch
new file mode 100644
index 0000000..3ea3cb8
--- /dev/null
+++ b/xpdf-3.01pl2.patch
@@ -0,0 +1,471 @@
+diff -cr xpdf-3.01.orig/goo/gmem.c xpdf-3.01/goo/gmem.c
+*** xpdf-3.01.orig/goo/gmem.c Tue Aug 16 22:34:30 2005
+--- xpdf-3.01/goo/gmem.c Tue Jan 17 17:03:57 2006
+***************
+*** 11,16 ****
+--- 11,17 ----
+ #include <stdlib.h>
+ #include <stddef.h>
+ #include <string.h>
++ #include <limits.h>
+ #include "gmem.h"
+
+ #ifdef DEBUG_MEM
+***************
+*** 63,69 ****
+ int lst;
+ unsigned long *trl, *p;
+
+! if (size == 0)
+ return NULL;
+ size1 = gMemDataSize(size);
+ if (!(mem = (char *)malloc(size1 + gMemHdrSize + gMemTrlSize))) {
+--- 64,70 ----
+ int lst;
+ unsigned long *trl, *p;
+
+! if (size <= 0)
+ return NULL;
+ size1 = gMemDataSize(size);
+ if (!(mem = (char *)malloc(size1 + gMemHdrSize + gMemTrlSize))) {
+***************
+*** 86,92 ****
+ #else
+ void *p;
+
+! if (size == 0)
+ return NULL;
+ if (!(p = malloc(size))) {
+ fprintf(stderr, "Out of memory\n");
+--- 87,93 ----
+ #else
+ void *p;
+
+! if (size <= 0)
+ return NULL;
+ if (!(p = malloc(size))) {
+ fprintf(stderr, "Out of memory\n");
+***************
+*** 102,108 ****
+ void *q;
+ int oldSize;
+
+! if (size == 0) {
+ if (p)
+ gfree(p);
+ return NULL;
+--- 103,109 ----
+ void *q;
+ int oldSize;
+
+! if (size <= 0) {
+ if (p)
+ gfree(p);
+ return NULL;
+***************
+*** 120,126 ****
+ #else
+ void *q;
+
+! if (size == 0) {
+ if (p)
+ free(p);
+ return NULL;
+--- 121,127 ----
+ #else
+ void *q;
+
+! if (size <= 0) {
+ if (p)
+ free(p);
+ return NULL;
+***************
+*** 140,147 ****
+ void *gmallocn(int nObjs, int objSize) {
+ int n;
+
+ n = nObjs * objSize;
+! if (objSize == 0 || n / objSize != nObjs) {
+ fprintf(stderr, "Bogus memory allocation size\n");
+ exit(1);
+ }
+--- 141,151 ----
+ void *gmallocn(int nObjs, int objSize) {
+ int n;
+
++ if (nObjs == 0) {
++ return NULL;
++ }
+ n = nObjs * objSize;
+! if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) {
+ fprintf(stderr, "Bogus memory allocation size\n");
+ exit(1);
+ }
+***************
+*** 151,158 ****
+ void *greallocn(void *p, int nObjs, int objSize) {
+ int n;
+
+ n = nObjs * objSize;
+! if (objSize == 0 || n / objSize != nObjs) {
+ fprintf(stderr, "Bogus memory allocation size\n");
+ exit(1);
+ }
+--- 155,168 ----
+ void *greallocn(void *p, int nObjs, int objSize) {
+ int n;
+
++ if (nObjs == 0) {
++ if (p) {
++ gfree(p);
++ }
++ return NULL;
++ }
+ n = nObjs * objSize;
+! if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) {
+ fprintf(stderr, "Bogus memory allocation size\n");
+ exit(1);
+ }
+diff -cr xpdf-3.01.orig/xpdf/JBIG2Stream.cc xpdf-3.01/xpdf/JBIG2Stream.cc
+*** xpdf-3.01.orig/xpdf/JBIG2Stream.cc Tue Aug 16 22:34:31 2005
+--- xpdf-3.01/xpdf/JBIG2Stream.cc Tue Jan 17 17:29:46 2006
+***************
+*** 13,18 ****
+--- 13,19 ----
+ #endif
+
+ #include <stdlib.h>
++ #include <limits.h>
+ #include "GList.h"
+ #include "Error.h"
+ #include "JArithmeticDecoder.h"
+***************
+*** 681,686 ****
+--- 682,691 ----
+ w = wA;
+ 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);
+ data[h * line] = 0;
+***************
+*** 692,697 ****
+--- 697,706 ----
+ w = bitmap->w;
+ 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);
+ memcpy(data, bitmap->data, h * line);
+***************
+*** 720,726 ****
+ }
+
+ void JBIG2Bitmap::expand(int newH, Guint pixel) {
+! if (newH <= h) {
+ return;
+ }
+ // need to allocate one extra guard byte for use in combine()
+--- 729,735 ----
+ }
+
+ void JBIG2Bitmap::expand(int newH, Guint pixel) {
+! if (newH <= h || line <= 0 || newH >= (INT_MAX - 1) / line) {
+ return;
+ }
+ // need to allocate one extra guard byte for use in combine()
+***************
+*** 2294,2299 ****
+--- 2303,2316 ----
+ !readUWord(&stepX) || !readUWord(&stepY)) {
+ goto eofError;
+ }
++ if (w == 0 || h == 0 || w >= INT_MAX / h) {
++ error(getPos(), "Bad bitmap size in JBIG2 halftone segment");
++ return;
++ }
++ if (gridH == 0 || gridW >= INT_MAX / gridH) {
++ error(getPos(), "Bad grid size in JBIG2 halftone segment");
++ return;
++ }
+
+ // get pattern dictionary
+ if (nRefSegs != 1) {
+diff -cr xpdf-3.01.orig/xpdf/JPXStream.cc xpdf-3.01/xpdf/JPXStream.cc
+*** xpdf-3.01.orig/xpdf/JPXStream.cc Tue Aug 16 22:34:31 2005
+--- xpdf-3.01/xpdf/JPXStream.cc Tue Jan 17 17:14:06 2006
+***************
+*** 12,17 ****
+--- 12,18 ----
+ #pragma implementation
+ #endif
+
++ #include <limits.h>
+ #include "gmem.h"
+ #include "Error.h"
+ #include "JArithmeticDecoder.h"
+***************
+*** 818,823 ****
+--- 819,830 ----
+ / img.xTileSize;
+ img.nYTiles = (img.ySize - img.yTileOffset + img.yTileSize - 1)
+ / img.yTileSize;
++ // check for overflow before allocating memory
++ if (img.nXTiles <= 0 || img.nYTiles <= 0 ||
++ img.nXTiles >= INT_MAX / img.nYTiles) {
++ error(getPos(), "Bad tile count in JPX SIZ marker segment");
++ return gFalse;
++ }
+ img.tiles = (JPXTile *)gmallocn(img.nXTiles * img.nYTiles,
+ sizeof(JPXTile));
+ for (i = 0; i < img.nXTiles * img.nYTiles; ++i) {
+diff -cr xpdf-3.01.orig/xpdf/Stream.cc xpdf-3.01/xpdf/Stream.cc
+*** xpdf-3.01.orig/xpdf/Stream.cc Tue Aug 16 22:34:31 2005
+--- xpdf-3.01/xpdf/Stream.cc Tue Jan 17 17:31:52 2006
+***************
+*** 15,20 ****
+--- 15,21 ----
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <stddef.h>
++ #include <limits.h>
+ #ifndef WIN32
+ #include <unistd.h>
+ #endif
+***************
+*** 406,418 ****
+--- 407,432 ----
+ width = widthA;
+ nComps = nCompsA;
+ nBits = nBitsA;
++ predLine = NULL;
++ 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);
+ memset(predLine, 0, rowBytes);
+ predIdx = rowBytes;
++
++ ok = gTrue;
+ }
+
+ StreamPredictor::~StreamPredictor() {
+***************
+*** 1004,1009 ****
+--- 1018,1027 ----
+ FilterStream(strA) {
+ if (predictor != 1) {
+ pred = new StreamPredictor(this, predictor, columns, colors, bits);
++ if (!pred->isOk()) {
++ delete pred;
++ pred = NULL;
++ }
+ } else {
+ pred = NULL;
+ }
+***************
+*** 1259,1264 ****
+--- 1277,1285 ----
+ if (columns < 1) {
+ columns = 1;
+ }
++ if (columns + 4 <= 0) {
++ columns = INT_MAX - 4;
++ }
+ rows = rowsA;
+ endOfBlock = endOfBlockA;
+ black = blackA;
+***************
+*** 2899,2904 ****
+--- 2920,2930 ----
+ height = read16();
+ width = read16();
+ numComps = str->getChar();
++ if (numComps <= 0 || numComps > 4) {
++ error(getPos(), "Bad number of components in DCT stream");
++ numComps = 0;
++ return gFalse;
++ }
+ if (prec != 8) {
+ error(getPos(), "Bad DCT precision %d", prec);
+ return gFalse;
+***************
+*** 2925,2930 ****
+--- 2951,2961 ----
+ height = read16();
+ width = read16();
+ numComps = str->getChar();
++ if (numComps <= 0 || numComps > 4) {
++ error(getPos(), "Bad number of components in DCT stream");
++ numComps = 0;
++ return gFalse;
++ }
+ if (prec != 8) {
+ error(getPos(), "Bad DCT precision %d", prec);
+ return gFalse;
+***************
+*** 2947,2952 ****
+--- 2978,2988 ----
+
+ length = read16() - 2;
+ scanInfo.numComps = str->getChar();
++ if (scanInfo.numComps <= 0 || scanInfo.numComps > 4) {
++ error(getPos(), "Bad number of components in DCT stream");
++ scanInfo.numComps = 0;
++ return gFalse;
++ }
+ --length;
+ if (length != 2 * scanInfo.numComps + 3) {
+ error(getPos(), "Bad DCT scan info block");
+***************
+*** 3041,3046 ****
+--- 3077,3083 ----
+ numACHuffTables = index+1;
+ tbl = &acHuffTables[index];
+ } else {
++ index &= 0x0f;
+ if (index >= numDCHuffTables)
+ numDCHuffTables = index+1;
+ tbl = &dcHuffTables[index];
+***************
+*** 3827,3832 ****
+--- 3864,3873 ----
+ FilterStream(strA) {
+ if (predictor != 1) {
+ pred = new StreamPredictor(this, predictor, columns, colors, bits);
++ if (!pred->isOk()) {
++ delete pred;
++ pred = NULL;
++ }
+ } else {
+ pred = NULL;
+ }
+diff -cr xpdf-3.01.orig/xpdf/Stream.h xpdf-3.01/xpdf/Stream.h
+*** xpdf-3.01.orig/xpdf/Stream.h Tue Aug 16 22:34:31 2005
+--- xpdf-3.01/xpdf/Stream.h Tue Jan 17 17:19:54 2006
+***************
+*** 232,237 ****
+--- 232,239 ----
+
+ ~StreamPredictor();
+
++ GBool isOk() { return ok; }
++
+ int lookChar();
+ int getChar();
+
+***************
+*** 249,254 ****
+--- 251,257 ----
+ int rowBytes; // bytes per line
+ Guchar *predLine; // line buffer
+ int predIdx; // current index in predLine
++ GBool ok;
+ };
+
+ //------------------------------------------------------------------------
+***************
+*** 527,533 ****
+ short getWhiteCode();
+ short getBlackCode();
+ short lookBits(int n);
+! void eatBits(int n) { inputBits -= n; }
+ };
+
+ //------------------------------------------------------------------------
+--- 530,536 ----
+ short getWhiteCode();
+ short getBlackCode();
+ short lookBits(int n);
+! void eatBits(int n) { if ((inputBits -= n) < 0) inputBits = 0; }
+ };
+
+ //------------------------------------------------------------------------
+diff -cr xpdf-3.01.orig/splash/SplashXPathScanner.cc xpdf-3.01/splash/SplashXPathScanner.cc
+*** xpdf-3.01.orig/splash/SplashXPathScanner.cc Tue Aug 16 22:34:31 2005
+--- xpdf-3.01/splash/SplashXPathScanner.cc Wed Feb 1 17:01:14 2006
+***************
+*** 186,192 ****
+ }
+
+ void SplashXPathScanner::computeIntersections(int y) {
+! SplashCoord ySegMin, ySegMax, xx0, xx1;
+ SplashXPathSeg *seg;
+ int i, j;
+
+--- 186,192 ----
+ }
+
+ void SplashXPathScanner::computeIntersections(int y) {
+! SplashCoord xSegMin, xSegMax, ySegMin, ySegMax, xx0, xx1;
+ SplashXPathSeg *seg;
+ int i, j;
+
+***************
+*** 236,254 ****
+ } else if (seg->flags & splashXPathVert) {
+ xx0 = xx1 = seg->x0;
+ } else {
+! if (ySegMin <= y) {
+! // intersection with top edge
+! xx0 = seg->x0 + ((SplashCoord)y - seg->y0) * seg->dxdy;
+ } else {
+! // x coord of segment endpoint with min y coord
+! xx0 = (seg->flags & splashXPathFlip) ? seg->x1 : seg->x0;
+ }
+! if (ySegMax >= y + 1) {
+! // intersection with bottom edge
+! xx1 = seg->x0 + ((SplashCoord)y + 1 - seg->y0) * seg->dxdy;
+! } else {
+! // x coord of segment endpoint with max y coord
+! xx1 = (seg->flags & splashXPathFlip) ? seg->x0 : seg->x1;
+ }
+ }
+ if (xx0 < xx1) {
+--- 236,262 ----
+ } else if (seg->flags & splashXPathVert) {
+ xx0 = xx1 = seg->x0;
+ } else {
+! if (seg->x0 < seg->x1) {
+! xSegMin = seg->x0;
+! xSegMax = seg->x1;
+ } else {
+! xSegMin = seg->x1;
+! xSegMax = seg->x0;
+ }
+! // intersection with top edge
+! xx0 = seg->x0 + ((SplashCoord)y - seg->y0) * seg->dxdy;
+! // intersection with bottom edge
+! xx1 = seg->x0 + ((SplashCoord)y + 1 - seg->y0) * seg->dxdy;
+! // the segment may not actually extend to the top and/or bottom edges
+! if (xx0 < xSegMin) {
+! xx0 = xSegMin;
+! } else if (xx0 > xSegMax) {
+! xx0 = xSegMax;
+! }
+! if (xx1 < xSegMin) {
+! xx1 = xSegMin;
+! } else if (xx1 > xSegMax) {
+! xx1 = xSegMax;
+ }
+ }
+ if (xx0 < xx1) {
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"
+ " Ctrl<Key>a:beginning-of-line()\\n"
+ " Ctrl<Key>b: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 <stdlib.h>
+ #include <string.h>
++ #include <limits.h>
+ #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 <stdio.h>
++ #include <limits.h>
+ #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 <p> 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-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 <p> 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 at splash; $(MAKE)
+ cd @UP_DIR at xpdf; $(MAKE) xpdf$(EXE)
+
++pdftopng: dummy
++ cd goo; $(MAKE)
++ cd @UP_DIR at fofi; $(MAKE)
++ cd @UP_DIR at splash; $(MAKE)
++ cd @UP_DIR at xpdf; $(MAKE) pdftopng$(EXE)
++
+ pdftops: dummy
+ cd goo; $(MAKE)
+ cd @UP_DIR at 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
new file mode 100644
index 0000000..8cd4dd9
--- /dev/null
+++ b/xpdf.desktop
@@ -0,0 +1,14 @@
+[Desktop Entry]
+Categories=Graphics;
+X-Desktop-File-Install-Version=0.2
+Name=Xpdf PDF Viewer
+Name[sv]=Xpdf PDF-visare
+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 %f
+Terminal=false
+Type=Application
+Icon=xpdf
+MimeType=application/pdf;
diff --git a/xpdf.png b/xpdf.png
new file mode 100644
index 0000000..6bab84a
Binary files /dev/null and b/xpdf.png differ
diff --git a/xpdf.spec b/xpdf.spec
new file mode 100644
index 0000000..b540c62
--- /dev/null
+++ b/xpdf.spec
@@ -0,0 +1,795 @@
+Summary: A PDF file viewer for the X Window System
+Name: xpdf
+Version: 3.04
+Release: 7%{?dist}
+License: GPLv2 or GPLv3
+Epoch: 1
+Url: http://www.foolabs.com/xpdf/
+Group: Applications/Publishing
+
+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-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-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.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
+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
+
+# 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: xdg-utils
+Requires: poppler-utils
+Requires: xorg-x11-fonts-ISO8859-1-75dpi
+Requires: xorg-x11-fonts-ISO8859-1-100dpi
+
+%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: libpaper-devel
+BuildRequires: libpng-devel
+BuildRequires: libXpm-devel
+
+Provides: %{name}-chinese-simplified = %{version}-%{release}
+Obsoletes: %{name}-chinese-simplified
+Provides: %{name}-chinese-traditional = %{version}-%{release}
+Obsoletes: %{name}-chinese-traditional
+Provides: %{name}-korean = %{version}-%{release}
+Obsoletes: %{name}-korean
+Provides: %{name}-japanese = %{version}-%{release}
+Obsoletes: %{name}-japanese
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+%description
+Xpdf is an X Window System based viewer for Portable Document Format
+(PDF) files. Xpdf is a small and efficient program which uses
+standard X fonts.
+
+%prep
+%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
+%patch11 -p1 -b .crash
+%patch12 -p1 -b .alloc
+%patch15 -p1
+%patch16 -p1 -b .fontlist
+%patch19 -p1
+%patch20 -p1 -b .pdftopng
+%patch21 -p1 -b .localized
+
+# security patches
+
+# debian patches
+%patch200 -p1 -b .permissions
+%patch201 -p1 -b .accelerators
+%patch203 -p1 -b .64bit-stream
+
+%build
+find -name "*orig" | xargs rm -f
+
+# This may seem pointless, but in the unlikely event that _sysconfdir != /etc ...
+for file in doc/*.1 doc/*.5 xpdf-*/README; do
+ sed -i -e 's:/etc/xpdfrc:%{_sysconfdir}/xpdfrc:g' $file
+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 \
+ --enable-multithreaded \
+ --enable-wordlist \
+ --with-x \
+ --enable-opi \
+ --with-appdef-dir=%{_datadir}/X11/app-defaults/ \
+ --without-Xp-library \
+ --with-freetype2-library=%{_libdir} \
+ --with-freetype2-includes=%{_includedir}/freetype2
+
+make %{?_smp_mflags}
+make xpdf %{?_smp_mflags}
+
+%install
+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*
+
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xpdf/
+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
+
+# 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 || :
+%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
+update-desktop-database &> /dev/null ||:
+
+%postun
+touch --no-create %{_datadir}/icons/hicolor || :
+%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
+update-desktop-database &> /dev/null ||:
+
+%files
+%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
+%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
+* Mon Jan 12 2015 Tom Callaway <spot at fedoraproject.org> - 1:3.04-7
+- add BR: libXpm-devel, drop --with-gzip (no longer exists)
+
+* Tue Dec 2 2014 Tom Callaway <spot at fedoraproject.org> - 1:3.04-6
+- fix proper display of international strings in the title (bz 1169301)
+
+* Fri Sep 12 2014 Tom Callaway <spot at fedoraproject.org> - 1:3.04-5
+- fix .desktop file
+
+* Mon Aug 18 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1:3.04-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
+
+* Sun Jun 08 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1:3.04-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
+
+* Tue Jun 3 2014 Tom Callaway <spot at fedoraproject.org> - 1:3.04-2
+- fix "sharexpdf" typo in lang configs
+
+* Thu May 29 2014 Tom Callaway <spot at fedoraproject.org> - 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 <spot at fedoraproject.org> - 1:3.03-8.1
+- rhel still needs pdfdetach in xpdf
+
+* Sun Sep 22 2013 Tom Callaway <spot at fedoraproject.org> - 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 <rel-eng at lists.fedoraproject.org> - 1:3.03-7
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
+
+* Sun Feb 10 2013 Parag Nemade <paragn AT fedoraproject DOT org> - 1:3.03-6
+- Remove vendor tag from desktop file as per https://fedorahosted.org/fesco/ticket/1077
+
+* Wed Nov 14 2012 Tom Callaway <spot at fedoraproject.org> - 1:3.03-5
+- fix desktop file to invoke xpdf with a file param (bz874644)
+
+* Sun Jul 22 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1:3.03-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
+
+* Fri May 25 2012 Tom Callaway <spot at fedoraproject.org> - 1:3.03-3
+- drop pdfdetach, poppler-utils has it now
+
+* Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1:3.03-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
+
+* Mon Aug 22 2011 Tom Callaway <spot at fedoraproject.org> - 1:3.03-1
+- update to 3.03
+
+* Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1:3.02-18
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
+
+* Fri Jan 21 2011 Tom Callaway <spot at fedoraproject.org> - 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 <tcallawa at redhat.com> - 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 <tcallawa at redhat.com> - 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 <rel-eng at lists.fedoraproject.org> - 1:3.02-14
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
+
+* Thu Apr 16 2009 Tom "spot" Callaway <tcallawa at redhat.com> - 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 <tcallawa at redhat.com> - 1:3.02-12
+- add Requires: xorg-x11-fonts-ISO8859-1-100dpi (bz 485404)
+
+* Thu Feb 26 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1:3.02-11
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
+
+* Wed Feb 11 2009 Tom "spot" Callaway <tcallawa at redhat.com> - 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 <tcallawa at redhat.com> - 1:3.02-9
+- apply debian patches
+
+* Sun Sep 21 2008 Ville Skyttä <ville.skytta at iki.fi> - 1:3.02-8
+- Fix Patch0:/%%patch mismatch.
+
+* Thu Jun 19 2008 Tom "spot" Callaway <tcallawa at redhat.com> 1:3.02-7
+- add missing Requires: xorg-x11-fonts-ISO8859-1-75dpi
+
+* Tue Feb 19 2008 Fedora Release Engineering <rel-eng at fedoraproject.org> - 1:3.02-6
+- Autorebuild for GCC 4.3
+
+* Wed Jan 2 2008 Tom "spot" Callaway <tcallawa at redhat.com> 1:3.02-5
+- use xdg-utils instead of htmlview (bz 313311)
+
+* Fri Nov 9 2007 Tom "spot" Callaway <tcallawa at redhat.com> 1:3.02-4
+- resolve 372461, 372471, 372481
+
+* Tue Aug 28 2007 Tom "spot" Callaway <tcallawa at redhat.com> 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 <tcallawa at redhat.com> 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 <tcallawa at redhat.com> 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 <tcallawa at redhat.com> 1:3.01-28
+- Requires: poppler-utils
+
+* Thu Dec 14 2006 Tom "spot" Callaway <tcallawa at redhat.com> 1:3.01-27
+- drop the xpdf-utils subpackage, poppler-utils ate it all
+
+* Mon Sep 25 2006 Tom "spot" Callaway <tcallawa at redhat.com> 1:3.01-26
+- get rid of goo/vms_* since they have questionable licensing
+
+* Mon Sep 25 2006 Tom "spot" Callaway <tcallawa at redhat.com> 1:3.01-25
+- patch thai/cyrillic files for proper pathing
+
+* Mon Sep 25 2006 Tom "spot" Callaway <tcallawa at redhat.com> 1:3.01-24
+- get rid of non-free CMap files
+- actually use thai/cyrillic sources
+- patch out the references to using CMap files
+
+* Mon Sep 25 2006 Tom "spot" Callaway <tcallawa at redhat.com> 1:3.01-23
+- new patch missed README files, fixed
+
+* Mon Sep 25 2006 Tom "spot" Callaway <tcallawa at redhat.com> 1:3.01-22
+- use latest localized files
+- fix redhat patch to work with new localized files
+
+* Mon Sep 25 2006 Tom "spot" Callaway <tcallawa at redhat.com> 1:3.01-21
+- use sane cp flags
+- remove hardcoded X-Red-Hat-Base from .desktop
+- mark the extra config files with their lang
+- get rid of unnecessary Requires post,postun
+
+* Sun Sep 24 2006 Tom "spot" Callaway <tcallawa at redhat.com> 1:3.01-20
+- use the proper icon
+
+* Sat Sep 23 2006 Tom "spot" Callaway <tcallawa at redhat.com> 1:3.01-19
+- get rid of unnecessary BR fileutils, findutils
+- get rid of duplicate R poppler-utils on main package
+- use _sysconfdir/xpdf hierarchy, own add-to-xpdfrc as config files
+- README files for each lang should be doc files, rename with lang ext
+- ensure that files reflect macro settings
+- use _sysconfdir macro
+- remove files without -rf
+- no need for /etc/X11/applnk/Graphics
+- update xpdf-3.01-redhat.patch accordingly
+
+* Sat Sep 23 2006 Tom "spot" Callaway <tcallawa at redhat.com> 1:3.01-18
+- use t1lib
+- remove non-utf8 character from old changelog
+- put png icon in hicolor/48x48/apps
+- use appropriate desktop scriptlets
+- set vendor="fedora"
+- move R:poppler-utils to xpdf-utils
+- remove period from xpdf-utils summary
+- add provides for everything we obsolete
+- get rid of autoconf, Xprint patch, just pass --without-Xp-library
+- add libpaper as BR
+
+* Fri Sep 22 2006 Tom "spot" Callaway <tcallawa at redhat.com> 1:3.01-17
+- move to Fedora Extras, use desktop-file-install
+
+* Wed Aug 09 2006 Than Ngo <than at redhat.com> 1:3.01-16
+- fix #200608, install icon in the wrong dir
+
+* Fri Jul 14 2006 Than Ngo <than at redhat.com> 1:3.01-15
+- fix build problem with new freetype
+
+* Wed Jul 12 2006 Jesse Keating <jkeating at redhat.com> - 1:3.01-14.1
+- rebuild
+
+* Wed Jun 28 2006 Than Ngo <than at redhat.com> 1:3.01-14
+- fix #197090, BR: autoconf
+
+* Fri May 5 2006 Adam Jackson <ajackson at redhat.com> 1:3.01-13
+- Remove spurious libXp dependency
+
+* Fri Feb 10 2006 Jesse Keating <jkeating at redhat.com> - 1:3.01-12.1
+- bump again for double-long bug on ppc(64)
+
+* Tue Feb 07 2006 Than Ngo <than at redhat.com> 3.01-12
+- apply patch to fix buffer overflow issue in the xpdf codebase
+ when handling splash images CVE-2006-0301 (#179423)
+
+* Tue Feb 07 2006 Jesse Keating <jkeating at redhat.com> - 1:3.01-11.1
+- rebuilt for new gcc4.1 snapshot and glibc changes
+
+* Mon Jan 23 2006 Than Ngo <than at redhat.com> 3.01-11
+- add correct app-defaults directory #178545
+
+* Wed Jan 18 2006 Ray Strode <rstrode at redhat.de> 3.01-10
+- remove requires line in utils subpackage
+
+* Wed Jan 18 2006 Ray Strode <rstrode at redhat.de> 3.01-9
+- remove pdf command-line utilities and require poppler ones
+ instead (bug 177446).
+
+* Wed Jan 18 2006 Than Ngo <than at redhat.com> 3.01-8
+- add new subpackage xpdf-utils
+
+* Tue Jan 10 2006 Karsten Hopp <karsten at redhat.de> 3.01-7
+- add patches to fix CVE-2005-3191 and CAN-2005-3193
+
+* Mon Dec 12 2005 Than Ngo <than at redhat.com> 3.01-6
+- rebuilt against new openmotif-2.3
+
+* Fri Dec 09 2005 Jesse Keating <jkeating at redhat.com>
+- rebuilt
+
+* Wed Nov 09 2005 Than Ngo <than at redhat.com> 3.01-5
+- add correct Simplified/Traditional Chinese fonts #170989
+
+* Tue Nov 08 2005 Than Ngo <than at redhat.com> 3.01-4
+- get rid of XFree86-devel
+
+* Thu Oct 13 2005 Matthias Clasen <mclasen at redhat.com> 3.01-3
+- don't use freetype internals
+
+* Fri Oct 07 2005 Than Ngo <than at redhat.com> 3.01-2
+- apply upstream patch to fix resize/redraw bug #166569
+
+* Thu Aug 18 2005 Than Ngo <than at redhat.com> 3.01-1
+- update to 3.01
+
+* Thu Aug 11 2005 Than Ngo <than at redhat.com> 3.00-24
+- change Kochi fonts to Sazanami fonts #165678
+
+* Tue Aug 09 2005 Than Ngo <than at redhat.com> 3.00-23
+- apply patch to fix xpdf DoS, CAN-2005-2097 #163918
+
+* Mon Jul 25 2005 Than Ngo <than at redhat.com> 3.00-22
+- fix allocation size 64bit architectures
+
+* Mon Jul 25 2005 Than Ngo <than at redhat.com> 3.00-21
+- fix xpdf crash #163807
+
+* Mon Jun 13 2005 Than Ngo <than at redhat.com> 3.00-20
+- urlCommand launches htmlview #160176
+- fix gcc4 build problem
+
+* Mon May 23 2005 Than Ngo <than at redhat.com> 3.00-19
+- apply patch to fix texts in non-embedded cjk font disappear, (#158509)
+
+* Sat Mar 05 2005 Than Ngo <than at redhat.com> 1:3.00-18
+- rebuilt
+
+* Thu Feb 10 2005 Than Ngo <than at redhat.com> 1:3.00-17
+- More fixing of CAN-2004-0888 patch (bug #135393)
+
+* Wed Jan 26 2005 Than Ngo <than at redhat.com> 1:3.00-16
+- Add patch to fix handling CID font encodings in freetype version >= 2.1.8 (bug #135066)
+
+* Thu Jan 20 2005 Than Ngo <than at redhat.com> 1:3.00-15
+- Applied patch to fix CAN-2005-0064 (bug #145050)
+
+* Wed Dec 22 2004 Tim Waugh <twaugh at redhat.com> 1:3.00-14
+- Applied patch to fix CAN-2004-1125 (bug #143500).
+
+* Mon Nov 29 2004 Than Ngo <than at redhat.com> 1:3.00-13
+- set match as default psPaperSize #141131
+
+* Tue Oct 26 2004 Than Ngo <than at redhat.com> 1:3.00-12
+- bump release
+
+* Tue Oct 26 2004 Than Ngo <than at redhat.com> 1:3.00-11
+- don't link against t1lib, use freetype2 for rendering
+
+* Thu Oct 21 2004 Than Ngo <than at redhat.com> 1:3.00-10
+- apply patch to fix CAN-2004-0888
+
+* Thu Oct 21 2004 Than Ngo <than at redhat.com> 1:3.00-9
+- fix xpdf crash #136633
+
+* Tue Oct 12 2004 Than Ngo <than at redhat.com> 1:3.00-8
+- fix default fonts setting
+
+* Mon Oct 11 2004 Than Ngo <than at redhat.com> 3.00-7
+- fix locale issue #133911
+
+* Thu Oct 07 2004 Than Ngo <than at redhat.com> 1:3.00-6
+- Fix xpdf crash when selecting outline without page reference,
+ thanks Ulrich Drepper, bz #134993
+
+* Thu Jun 24 2004 Than Ngo <than at redhat.com> 1:3.00-5
+- update t1lib upstream
+- add cjk font patch, thanks to Yukihiro Nakai, bug #123540
+- fix a bug in font rasterizer, bug #125559
+- improve menue entry, bug #125850
+
+* Tue Jun 15 2004 Elliot Lee <sopwith at redhat.com>
+- rebuilt
+
+* Fri Feb 20 2004 Than Ngo <than at redhat.com> 3.00-3
+- better fix for building with freetype 2.1.7
+
+* Tue Feb 17 2004 Than Ngo <than at redhat.com> 3.00-2
+- t1lib-5.0.1
+
+* Tue Jan 27 2004 Than Ngo <than at redhat.com> 3.00-1
+- 3.00 release
+- add patch file to built with new freetype-2.1.7
+
+* Mon Oct 13 2003 Than Ngo <than at redhat.com> 1:2.03-1
+- 2.03
+- remove xpdf-2.02pl1.patch, which is included in 2.03
+- fix warning issue (bug #106313)
+- fix huge memory leak, (bug #89552)
+
+* Tue Jul 29 2003 Than Ngo <than at redhat.com> 1:2.02-9
+- rebuild
+
+* Tue Jul 29 2003 Than Ngo <than at redhat.com> 1:2.02-8
+- add missing icon (bug #100780)
+- fix a bug xpdf resource
+
+* Tue Jun 17 2003 Than Ngo <than at redhat.com> 2.02-7
+- fixes a security hole
+
+* Wed Jun 04 2003 Elliot Lee <sopwith at redhat.com>
+- rebuilt
+
+* Mon May 5 2003 Than Ngo <than at redhat.com> 2.02-4.1
+- merge sub packages to main package (bug #87750)
+
+* Fri May 2 2003 Than Ngo <than at redhat.com> 2.02-3.1
+- don't install backup files
+
+* Mon Mar 31 2003 Than Ngo <than at redhat.com> 2.02-2
+- build with freetype in RHL, #79680
+- unsafe temporary files, #79682
+- add Xfree86-devel in buildprereq
+- build with -O0 on ppc, gcc bug
+
+* Tue Mar 25 2003 Than Ngo <than at redhat.com> 2.02-1
+- 2.02
+- adjust some patch files for 2.02
+
+* Tue Feb 18 2003 Than Ngo <than at redhat.com> 2.01-8
+- own /usr/share/xpdf, #73983
+- remove debug unused infos, #84197
+
+* Tue Feb 4 2003 Than Ngo <than at redhat.com> 2.01-7
+- fix #82634
+
+* Mon Feb 3 2003 Than Ngo <than at redhat.com> 2.01-6
+- fix #82633
+
+* Mon Jan 27 2003 Than Ngo <than at redhat.com> 2.01-5
+- added locale patch from ynakai at redhat.com, bug #82638
+
+* Wed Jan 22 2003 Tim Powers <timp at redhat.com>
+- rebuilt
+
+* Mon Jan 20 2003 Than Ngo <than at redhat.com> 2.01-3
+- Security fixes.
+
+* Sun Dec 8 2002 Than Ngo <than at redhat.com> 2.01-2
+- urlCommand launches htmlview (bug #76694)
+
+* Fri Dec 6 2002 Than Ngo <than at redhat.com> 2.01-1
+- update to 2.01
+
+* Wed Nov 6 2002 Than Ngo <than at redhat.com> 2.00-1
+- update to 2.00
+- adapt a patch file for 2.00
+- build against openmotif
+
+* Fri Sep 20 2002 Than Ngo <than at redhat.com> 1.01-9
+- Build against new freetype
+
+* Mon Aug 26 2002 Than Ngo <than at redhat.com> 1.01-8
+- add descriptive name (bug #71673)
+
+* Sat Aug 10 2002 Elliot Lee <sopwith at redhat.com>
+- rebuilt with gcc-3.2 (we hope)
+
+* Wed Jul 24 2002 Than Ngo <than at redhat.com> 1.01-6
+- desktop file issue (bug #69554)
+
+* Tue Jul 23 2002 Tim Powers <timp at redhat.com> 1.01-5
+- build using gcc-3.2-0.1
+
+* Fri Jun 21 2002 Tim Powers <timp at redhat.com> 1.01-4
+- automated rebuild
+
+* Sun Jun 2 2002 Than Ngo <than at redhat.com> 1.01-3
+- fix a bug in open file dialog (bug #39844)
+- 1.01 handles Type 3 fonts (bug #48843)
+
+* Sun May 26 2002 Tim Powers <timp at redhat.com>
+- automated rebuild
+
+* Thu May 23 2002 Harald Hoyer <harald at redhat.de> 1.01-1
+- xpdf-1.01, freetype-2.0.9
+
+* Sun Mar 17 2002 Than Ngo <than at redhat.com> 1.00-3
+- rebuild
+
+* Thu Feb 21 2002 Than Ngo <than at redhat.com> 1.00-2
+- fix Bad 'urlCommand' (bug #59730)
+
+* Tue Feb 05 2002 Than Ngo <than at redhat.com> 1.00-1
+- update to 1.00 (bug #59239, #48904)
+- remove some patch files, which are included in 1.00
+- sub packages for chinese-simplified, chinese-traditional, japanese and korean
+
+* Fri Jan 25 2002 Than Ngo <than at redhat.com> 0.93-4
+- rebuild in rawhide
+
+* Mon Nov 12 2001 Than Ngo <than at redhat.com> 0.93-2
+- enable Chinese GB font support
+- enable Chinese CNS font support
+- enable use of FreeType 2
+
+* Mon Oct 29 2001 Than Ngo <than at redhat.com> 0.93-1
+- update to 0.93
+
+* Wed Sep 12 2001 Tim Powers <timp at redhat.com>
+- rebuild with new gcc and binutils
+
+* Sun Jun 24 2001 Elliot Lee <sopwith at redhat.com>
+- Bump release + rebuild.
+
+* Fri Apr 27 2001 Bill Nottingham <notting at redhat.com>
+- rebuild for C++ exception handling on ia64
+
+* Wed Mar 28 2001 Than Ngo <than at redhat.com>
+- add german translation into desktop file
+- move desktop file to /etc/X11/applnk/Graphics (Bug #32720)
+
+* Tue Jan 02 2001 Than Ngo <than at redhat.com>
+- added a default URL handler script with a corresponding definition
+ in Xpdf, thanks to Michal Jaegermann <michal at harddata.com> (Bug #23112)
+
+* Mon Dec 04 2000 Than Ngo <than at redhat.com>
+- updated to 0.92 (Bug #16646)
+- remove some patches, which included in xpdf-0.92
+
+* Mon Oct 16 2000 Than Ngo <than at redhat.com>
+- rebuild for 7.1
+
+* Wed Oct 11 2000 Than Ngo <than at redhat.com>
+- fix update problem (Bug #17924)
+
+* Thu Aug 17 2000 Than Ngo <than at redhat.com>
+- update to 0.91 (Bug #9961 and many major bugs)
+
+* Sun Aug 06 2000 Than Ngo <than at redhat.de>
+- added swedish translation (Bug 15312)
+
+* Thu Jul 13 2000 Prospector <bugzilla at redhat.com>
+- automatic rebuild
+
+* Sun Jul 2 2000 Jakub Jelinek <jakub at redhat.com>
+- Rebuild with new C++
+
+* Fri Jun 16 2000 Than Ngo <than at redhat.de>
+- enable Japanese font support
+
+* Fri Jun 16 2000 Preston Brown <pbrown at redhat.com>
+- FHS paths
+- better .desktop entry file
+
+* Tue Jun 06 2000 Than Ngo <than at redhat.de>
+- fix xpdf crashes on some data streams (Bug# 10154) (thanks Derek)
+- add %%defattr
+- use rpm macros
+
+* Tue May 23 2000 Ngo Than <than at redhat.de>
+- fix problem with loading fonts
+
+* Sun May 21 2000 Ngo Than <than at redhat.de>
+- put man pages in /usr/share/man/*
+- update t1lib-1.0.1
+
+* Mon May 08 2000 Trond Eivind Glomsrod <teg at redhat.com>
+- fixed URL
+
+* Fri Feb 11 2000 Preston Brown <pbrown at redhat.com>
+- build for inclusion in 6.2.
+
+* Wed Feb 09 2000 Jakub Jelinek <jakub at redhat.com>
+- include decryption patches
+
+* Mon Feb 07 2000 Presto Brown <pbrown at redhat.com>
+- rebuild to gzip man pages
+
+* Mon Aug 30 1999 Preston Brown <pbrown at redhat.com>
+- upgrade to xpdf 0.90, include t1lib Type1 rasterizer
+- fix zapfdingbats font mapping issue
+
+* Sun Mar 21 1999 Cristian Gafton <gafton at redhat.com>
+- auto rebuild in the new build environment (release 4)
+
+* Wed Mar 17 1999 Preston Brown <pbrown at redhat.com>
+- converted wmconfig to desktop entry
+
+* Wed Feb 24 1999 Preston Brown <pbrown at redhat.com>
+- Injected new description and group.
+
+* Mon Nov 30 1998 Preston Brown <pbrown at redhat.com>
+- updated to 0.80
+
+* Fri Nov 06 1998 Preston Brown <pbrown at redhat.com>
+- patched to compile with new, stricter egcs
+
+* Tue May 05 1998 Cristian Gafton <gafton at redhat.com>
+- updated to 0.7a
+
+* Thu Nov 20 1997 Otto Hammersmith <otto at redhat.com>
+- added changelog
+- added wmconfig
--
cgit v0.10.2
http://pkgs.fedoraproject.org/cgit/xpdf.git/commit/?h=epel7&id=0e002320df7771f383bc99d0c0c88e0f4cf727da
More information about the scm-commits
mailing list