texlive[50962] Build/source/libs: xpdf 4.01.01

commits+kakuto at tug.org commits+kakuto at tug.org
Fri May 3 06:51:31 CEST 2019


Revision: 50962
          http://tug.org/svn/texlive?view=revision&revision=50962
Author:   kakuto
Date:     2019-05-03 06:51:31 +0200 (Fri, 03 May 2019)
Log Message:
-----------
xpdf 4.01.01

Modified Paths:
--------------
    trunk/Build/source/libs/README
    trunk/Build/source/libs/xpdf/ChangeLog
    trunk/Build/source/libs/xpdf/TLpatches/ChangeLog
    trunk/Build/source/libs/xpdf/TLpatches/TL-Changes
    trunk/Build/source/libs/xpdf/TLpatches/patch-bunched
    trunk/Build/source/libs/xpdf/configure
    trunk/Build/source/libs/xpdf/version.ac
    trunk/Build/source/libs/xpdf/xpdf-src/CHANGES
    trunk/Build/source/libs/xpdf/xpdf-src/INSTALL
    trunk/Build/source/libs/xpdf/xpdf-src/README
    trunk/Build/source/libs/xpdf/xpdf-src/splash/Splash.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Lexer.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/SecurityHandler.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/config.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdffonts.cc

Modified: trunk/Build/source/libs/README
===================================================================
--- trunk/Build/source/libs/README	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/README	2019-05-03 04:51:31 UTC (rev 50962)
@@ -59,7 +59,7 @@
 teckit 2.5.9 - checked 03may19
   https://github.com/silnrsi/teckit/archive/2.5.9.tar.gz
 
-xpdf 4.01 - checked 25feb19
+xpdf 4.01.01 - checked 03may19
   http://www.xpdfreader.com/download.html
   with modifications for pdftex
 

Modified: trunk/Build/source/libs/xpdf/ChangeLog
===================================================================
--- trunk/Build/source/libs/xpdf/ChangeLog	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/ChangeLog	2019-05-03 04:51:31 UTC (rev 50962)
@@ -1,3 +1,8 @@
+2019-05-03  Akira Kakuto  <kakuto at w32tex.org>
+
+	* Import xpdf-4.01.01.
+	* version.ac: Adjust.
+
 2019-02-25  Akira Kakuto  <kakuto at w32tex.org>
 
 	* Import xpdf-4.01.

Modified: trunk/Build/source/libs/xpdf/TLpatches/ChangeLog
===================================================================
--- trunk/Build/source/libs/xpdf/TLpatches/ChangeLog	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/TLpatches/ChangeLog	2019-05-03 04:51:31 UTC (rev 50962)
@@ -1,3 +1,7 @@
+2019-05-03  Akira Kakuto  <kakuto at w32tex.org>
+
+	* patch-bunched: Adjust.
+
 2019-02-25  Akira Kakuto  <kakuto at w32tex.org>
 
 	* patch-bunched: Adjust.

Modified: trunk/Build/source/libs/xpdf/TLpatches/TL-Changes
===================================================================
--- trunk/Build/source/libs/xpdf/TLpatches/TL-Changes	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/TLpatches/TL-Changes	2019-05-03 04:51:31 UTC (rev 50962)
@@ -1,4 +1,4 @@
-Changes applied to the xpdf-4.01/ tree as obtained from:
+Changes applied to the xpdf-4.01.01/ tree as obtained from:
 	http://www.xpdfreader.com/download.html
 
 Removed:

Modified: trunk/Build/source/libs/xpdf/TLpatches/patch-bunched
===================================================================
--- trunk/Build/source/libs/xpdf/TLpatches/patch-bunched	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/TLpatches/patch-bunched	2019-05-03 04:51:31 UTC (rev 50962)
@@ -1,5 +1,5 @@
-diff -ur xpdf-4.01/goo/gfile.cc xpdf-src/goo/gfile.cc
---- xpdf-4.01/goo/gfile.cc	Tue Feb 19 03:24:19 2019
+diff -ur xpdf-4.01.01/goo/gfile.cc xpdf-src/goo/gfile.cc
+--- xpdf-4.01.01/goo/gfile.cc	Fri Mar 15 06:01:02 2019
 +++ xpdf-src/goo/gfile.cc	Mon Feb 25 11:09:32 2019
 @@ -7,6 +7,9 @@
  // Copyright 1996-2003 Glyph & Cog, LLC
@@ -74,8 +74,8 @@
  #endif
  }
 +#endif /* !PDF_PARSER_ONLY */
-diff -ur xpdf-4.01/goo/gfile.h xpdf-src/goo/gfile.h
---- xpdf-4.01/goo/gfile.h	Tue Feb 19 03:24:19 2019
+diff -ur xpdf-4.01.01/goo/gfile.h xpdf-src/goo/gfile.h
+--- xpdf-4.01.01/goo/gfile.h	Fri Mar 15 06:01:02 2019
 +++ xpdf-src/goo/gfile.h	Mon Feb 25 11:07:26 2019
 @@ -114,6 +114,8 @@
  
@@ -86,8 +86,8 @@
 +#endif /* !PDF_PARSER_ONLY */
  
  #endif
-diff -ur xpdf-4.01/xpdf/GlobalParams.cc xpdf-src/xpdf/GlobalParams.cc
---- xpdf-4.01/xpdf/GlobalParams.cc	Tue Feb 19 03:24:19 2019
+diff -ur xpdf-4.01.01/xpdf/GlobalParams.cc xpdf-src/xpdf/GlobalParams.cc
+--- xpdf-4.01.01/xpdf/GlobalParams.cc	Fri Mar 15 06:01:02 2019
 +++ xpdf-src/xpdf/GlobalParams.cc	Mon Feb 25 08:01:11 2019
 @@ -5,6 +5,9 @@
  // Copyright 2001-2003 Glyph & Cog, LLC
@@ -142,8 +142,8 @@
        }
      }
    }
-diff -ur xpdf-4.01/xpdf/GlobalParams.h xpdf-src/xpdf/GlobalParams.h
---- xpdf-4.01/xpdf/GlobalParams.h	Tue Feb 19 03:24:19 2019
+diff -ur xpdf-4.01.01/xpdf/GlobalParams.h xpdf-src/xpdf/GlobalParams.h
+--- xpdf-4.01.01/xpdf/GlobalParams.h	Fri Mar 15 06:01:02 2019
 +++ xpdf-src/xpdf/GlobalParams.h	Mon Feb 25 08:02:36 2019
 @@ -5,6 +5,9 @@
  // Copyright 2001-2003 Glyph & Cog, LLC
@@ -164,9 +164,9 @@
  
    ~GlobalParams();
  
-diff -ur xpdf-4.01/xpdf/PDFDoc.cc xpdf-src/xpdf/PDFDoc.cc
---- xpdf-4.01/xpdf/PDFDoc.cc	Tue Feb 19 03:24:19 2019
-+++ xpdf-src/xpdf/PDFDoc.cc	Mon Feb 25 08:16:35 2019
+diff -ur xpdf-4.01.01/xpdf/PDFDoc.cc xpdf-src/xpdf/PDFDoc.cc
+--- xpdf-4.01.01/xpdf/PDFDoc.cc	Fri Mar 15 06:01:02 2019
++++ xpdf-src/xpdf/PDFDoc.cc	Sun Mar 17 08:59:43 2019
 @@ -147,20 +147,25 @@
  
  PDFDoc::PDFDoc(char *fileNameA, GString *ownerPassword,
@@ -206,7 +206,7 @@
  #elif defined(VMS)
    file = fopen(fileName->getCString(), "rb", "ctx=stm");
  #else
-@@ -571,6 +580,7 @@
+@@ -572,6 +581,7 @@
    GBool ret;
  
    // NB: _wfopen is only available in NT
@@ -214,7 +214,7 @@
    version.dwOSVersionInfoSize = sizeof(version);
    GetVersionEx(&version);
    if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) {
-@@ -580,12 +590,15 @@
+@@ -581,12 +591,15 @@
      path2w[i] = 0;
      f = _wfopen(path2w, L"wb");
    } else {
@@ -230,8 +230,8 @@
    if (!f) {
      return gFalse;
    }
-diff -ur xpdf-4.01/xpdf/Page.cc xpdf-src/xpdf/Page.cc
---- xpdf-4.01/xpdf/Page.cc	Tue Feb 19 03:24:19 2019
+diff -ur xpdf-4.01.01/xpdf/Page.cc xpdf-src/xpdf/Page.cc
+--- xpdf-4.01.01/xpdf/Page.cc	Fri Mar 15 06:01:02 2019
 +++ xpdf-src/xpdf/Page.cc	Mon Feb 25 08:19:00 2019
 @@ -480,9 +480,9 @@
    delete links;
@@ -251,8 +251,8 @@
 -}
  #endif
 +}
-diff -ur xpdf-4.01/xpdf/XFAForm.cc xpdf-src/xpdf/XFAForm.cc
---- xpdf-4.01/xpdf/XFAForm.cc	Tue Feb 19 03:24:19 2019
+diff -ur xpdf-4.01.01/xpdf/XFAForm.cc xpdf-src/xpdf/XFAForm.cc
+--- xpdf-4.01.01/xpdf/XFAForm.cc	Fri Mar 15 06:01:02 2019
 +++ xpdf-src/xpdf/XFAForm.cc	Mon Feb 25 08:20:00 2019
 @@ -28,8 +28,10 @@
  #include "XFAForm.h"
@@ -267,9 +267,9 @@
  #endif
  
  //------------------------------------------------------------------------
-diff -ur xpdf-4.01/xpdf/config.h xpdf-src/xpdf/config.h
---- xpdf-4.01/xpdf/config.h	Tue Feb 19 03:24:19 2019
-+++ xpdf-src/xpdf/config.h	Mon Feb 25 08:21:02 2019
+diff -ur xpdf-4.01.01/xpdf/config.h xpdf-src/xpdf/config.h
+--- xpdf-4.01.01/xpdf/config.h	Fri Mar 15 06:01:02 2019
++++ xpdf-src/xpdf/config.h	Sun Mar 17 16:09:03 2019
 @@ -78,11 +78,6 @@
  // popen
  //------------------------------------------------------------------------

Modified: trunk/Build/source/libs/xpdf/configure
===================================================================
--- trunk/Build/source/libs/xpdf/configure	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/configure	2019-05-03 04:51:31 UTC (rev 50962)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for xpdf (TeX Live) 4.01.
+# Generated by GNU Autoconf 2.69 for xpdf (TeX Live) 4.01.01.
 #
 # Report bugs to <tex-k at tug.org>.
 #
@@ -580,8 +580,8 @@
 # Identity of this package.
 PACKAGE_NAME='xpdf (TeX Live)'
 PACKAGE_TARNAME='xpdf--tex-live-'
-PACKAGE_VERSION='4.01'
-PACKAGE_STRING='xpdf (TeX Live) 4.01'
+PACKAGE_VERSION='4.01.01'
+PACKAGE_STRING='xpdf (TeX Live) 4.01.01'
 PACKAGE_BUGREPORT='tex-k at tug.org'
 PACKAGE_URL=''
 
@@ -1290,7 +1290,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures xpdf (TeX Live) 4.01 to adapt to many kinds of systems.
+\`configure' configures xpdf (TeX Live) 4.01.01 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1356,7 +1356,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of xpdf (TeX Live) 4.01:";;
+     short | recursive ) echo "Configuration of xpdf (TeX Live) 4.01.01:";;
    esac
   cat <<\_ACEOF
 
@@ -1460,7 +1460,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-xpdf (TeX Live) configure 4.01
+xpdf (TeX Live) configure 4.01.01
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1867,7 +1867,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by xpdf (TeX Live) $as_me 4.01, which was
+It was created by xpdf (TeX Live) $as_me 4.01.01, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3791,7 +3791,7 @@
 
 # Define the identity of the package.
  PACKAGE='xpdf--tex-live-'
- VERSION='4.01'
+ VERSION='4.01.01'
 
 
 # Some tools Automake needs.
@@ -6704,7 +6704,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by xpdf (TeX Live) $as_me 4.01, which was
+This file was extended by xpdf (TeX Live) $as_me 4.01.01, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -6774,7 +6774,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-xpdf (TeX Live) config.status 4.01
+xpdf (TeX Live) config.status 4.01.01
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 

Modified: trunk/Build/source/libs/xpdf/version.ac
===================================================================
--- trunk/Build/source/libs/xpdf/version.ac	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/version.ac	2019-05-03 04:51:31 UTC (rev 50962)
@@ -8,4 +8,4 @@
 dnl --------------------------------------------------------
 dnl
 dnl  m4-include this file to define the current xpdf version
-m4_define([xpdf_version], [4.01])
+m4_define([xpdf_version], [4.01.01])

Modified: trunk/Build/source/libs/xpdf/xpdf-src/CHANGES
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/CHANGES	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/xpdf-src/CHANGES	2019-05-03 04:51:31 UTC (rev 50962)
@@ -2539,3 +2539,14 @@
   [Thanks to r4xis for the bug report.]
 Check for invalid quant table indexes in the DCT decoder.  [Thanks to
   r4xis for the bug report.]
+
+4.01.01 (2019-mar-14)
+---------------------
+The PDFDoc(BaseStream) initializer wasn't working correctly.
+Fixed a missing array bounds check in PSOutputDev.  [Thanks to
+  Loginsoft for the bug report.]
+If the "U" string used for RC4 decryption is short, Adobe apparently
+  zero-pads it, so Xpdf now does the same.
+Pdffonts now checks more carefully for loops between objects.
+Fixed a problem parsing large real numbers.  [Thanks to Loginsoft for
+  the bug report.]

Modified: trunk/Build/source/libs/xpdf/xpdf-src/INSTALL
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/INSTALL	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/xpdf-src/INSTALL	2019-05-03 04:51:31 UTC (rev 50962)
@@ -1,8 +1,8 @@
 Xpdf
 ====
 
-version 4.01
-2019-feb-18
+version 4.01.01
+2019-mar-14
 
 The Xpdf software and documentation are
 copyright 1996-2019 Glyph & Cog, LLC.

Modified: trunk/Build/source/libs/xpdf/xpdf-src/README
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/README	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/xpdf-src/README	2019-05-03 04:51:31 UTC (rev 50962)
@@ -1,8 +1,8 @@
 Xpdf
 ====
 
-version 4.01
-2019-feb-18
+version 4.01.01
+2019-mar-14
 
 The Xpdf software and documentation are
 copyright 1996-2019 Glyph & Cog, LLC.

Modified: trunk/Build/source/libs/xpdf/xpdf-src/splash/Splash.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/splash/Splash.cc	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/xpdf-src/splash/Splash.cc	2019-05-03 04:51:31 UTC (rev 50962)
@@ -4567,7 +4567,8 @@
   SplashCoord xMin, yMin, xMax, yMax, t;
   SplashCoord mi0, mi1, mi2, mi3, mi4, mi5, det;
   SplashCoord ix, iy, sx, sy, pix0, pix1;
-  int rowSize, xMinI, yMinI, xMaxI, yMaxI, x, y, x0, y0, x1, y1, tt, i;
+  SplashBitmapRowSize rowSize;
+  int xMinI, yMinI, xMaxI, yMaxI, x, y, x0, y0, x1, y1, tt, i;
 
   // compute the bbox of the target quadrilateral
   xMin = xMax = mat[4];
@@ -4653,7 +4654,7 @@
   } else {
     rowSize = srcWidth * nComps;
   }
-  unscaledImage = (SplashColorPtr)gmallocn(srcHeight, rowSize);
+  unscaledImage = (SplashColorPtr)gmallocn64(srcHeight, rowSize);
   if (srcAlpha) {
     unscaledAlpha = (Guchar *)gmallocn(srcHeight, srcWidth);
     for (y = 0, p = unscaledImage, alphaPtr = unscaledAlpha;
@@ -4663,7 +4664,7 @@
     }
   } else {
     unscaledAlpha = NULL;
-    for (y = 0, p = unscaledImage; y < srcHeight; ++y, p += srcWidth * nComps) {
+    for (y = 0, p = unscaledImage; y < srcHeight; ++y, p += rowSize) {
       (*src)(srcData, p, NULL);
     }
   }
@@ -4698,10 +4699,10 @@
 	  if (y1 >= srcHeight) {
 	    y1 = srcHeight - 1;
 	  }
-	  q00 = &unscaledImage[(y0 * srcWidth + x0) * nComps];
-	  q01 = &unscaledImage[(y0 * srcWidth + x1) * nComps];
-	  q10 = &unscaledImage[(y1 * srcWidth + x0) * nComps];
-	  q11 = &unscaledImage[(y1 * srcWidth + x1) * nComps];
+	  q00 = &unscaledImage[y0 * rowSize + (SplashBitmapRowSize)x0 * nComps];
+	  q01 = &unscaledImage[y0 * rowSize + (SplashBitmapRowSize)x1 * nComps];
+	  q10 = &unscaledImage[y1 * rowSize + (SplashBitmapRowSize)x0 * nComps];
+	  q11 = &unscaledImage[y1 * rowSize + (SplashBitmapRowSize)x1 * nComps];
 	  for (i = 0; i < nComps; ++i) {
 	    pix0 = ((SplashCoord)1 - sx) * (int)*q00++ + sx * (int)*q01++;
 	    pix1 = ((SplashCoord)1 - sx) * (int)*q10++ + sx * (int)*q11++;
@@ -4730,7 +4731,7 @@
 	x0 = splashFloor(ix);
 	y0 = splashFloor(iy);
 	if (x0 >= 0 && x0 < srcWidth && y0 >= 0 && y0 < srcHeight) {
-	  q = &unscaledImage[(y0 * srcWidth + x0) * nComps];
+	  q = &unscaledImage[y0 * rowSize + (SplashBitmapRowSize)x0 * nComps];
 	  for (i = 0; i < nComps; ++i) {
 	    *p++ = *q++;
 	  }

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc	2019-05-03 04:51:31 UTC (rev 50962)
@@ -1542,6 +1542,13 @@
     fontSize = atof(tok->getCString());
   } else {
     error(errSyntaxError, -1, "Missing 'Tf' operator in field's DA string");
+    fontSize = 10;
+    if (!daToks) {
+      daToks = new GList();
+    }
+    daToks->append(new GString("/xpdf_default_font"));
+    daToks->append(new GString("10"));
+    daToks->append(new GString("Tf"));
   }
 
   // setup
@@ -1603,7 +1610,11 @@
     // starting y coordinate
     // (note: each line of text starts with a Td operator that moves
     // down a line)
-    y = dy - 3;
+    if (dy > fontSize + 6) {
+      y = dy - 3;
+    } else {
+      y = 0.5 * dy - 0.4 * fontSize + fontSize;
+    }
 
     // set the font matrix
     if (tmPos >= 0) {

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Lexer.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Lexer.cc	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Lexer.cc	2019-05-03 04:51:31 UTC (rev 50962)
@@ -179,7 +179,9 @@
       if (isdigit(c)) {
 	getChar();
 	xi = xi * 10 + (c - '0');
-	xf = xf * 10 + (c - '0');
+	if (xf < 1e20) {
+	  xf = xf * 10 + (c - '0');
+	}
       } else if (c == '.') {
 	getChar();
 	goto doReal;

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc	2019-05-03 04:51:31 UTC (rev 50962)
@@ -692,6 +692,24 @@
 	   tileMap->getPageBottomY(tileMap->getLastPage()));
 }
 
+void PDFCore::scrollToCentered(int page, double x, double y) {
+  int wx, wy, sx, sy;
+
+  startUpdate();
+
+  // scroll to the requested page
+  state->setScrollPosition(page, tileMap->getPageLeftX(page),
+			   tileMap->getPageTopY(page));
+
+  // scroll the requested point to the center of the window
+  cvtUserToWindow(page, x, y, &wx, &wy);
+  sx = state->getScrollX() + wx - state->getWinW() / 2;
+  sy = state->getScrollY() + wy - state->getWinH() / 2;
+  state->setScrollPosition(page, sx, sy);
+
+  finishUpdate(gTrue, gFalse);
+}
+
 void PDFCore::setZoom(double zoom) {
   int page;
 

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h	2019-05-03 04:51:31 UTC (rev 50962)
@@ -148,6 +148,8 @@
   virtual void scrollToBottomEdge();
   virtual void scrollToTopLeft();
   virtual void scrollToBottomRight();
+  // Scroll so that (page, x, y) is centered in the window.
+  virtual void scrollToCentered(int page, double x, double y);
   virtual void setZoom(double zoom);
   virtual void zoomToRect(int page, double ulx, double uly,
 			  double lrx, double lry);

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.cc	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.cc	2019-05-03 04:51:31 UTC (rev 50962)
@@ -232,6 +232,7 @@
     fileNameU = NULL;
 #endif
   }
+  str = strA;
   ok = setup(ownerPassword, userPassword);
 }
 

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.cc	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.cc	2019-05-03 04:51:31 UTC (rev 50962)
@@ -1924,8 +1924,12 @@
       skip = gFalse;
       if ((xObjDict.dictGetValNF(i, &xObjRef)->isRef())) {
 	ref0 = xObjRef.getRef();
-	skip = (GBool)visitedResources[ref0.num];
-	visitedResources[ref0.num] = 1;
+	if (ref0.num < 0 || ref0.num >= xref->getNumObjects()) {
+	  skip = gTrue;
+	} else {
+	  skip = (GBool)visitedResources[ref0.num];
+	  visitedResources[ref0.num] = 1;
+	}
       }
       if (!skip) {
 
@@ -1956,8 +1960,12 @@
       skip = gFalse;
       if ((patDict.dictGetValNF(i, &patRef)->isRef())) {
 	ref0 = patRef.getRef();
-	skip = (GBool)visitedResources[ref0.num];
-	visitedResources[ref0.num] = 1;
+	if (ref0.num < 0 || ref0.num >= xref->getNumObjects()) {
+	  skip = gTrue;
+	} else {
+	  skip = (GBool)visitedResources[ref0.num];
+	  visitedResources[ref0.num] = 1;
+	}
       }
       if (!skip) {
 
@@ -1988,8 +1996,12 @@
       skip = gFalse;
       if ((gsDict.dictGetValNF(i, &gsRef)->isRef())) {
 	ref0 = gsRef.getRef();
-	skip = (GBool)visitedResources[ref0.num];
-	visitedResources[ref0.num] = 1;
+	if (ref0.num < 0 || ref0.num >= xref->getNumObjects()) {
+	  skip = gTrue;
+	} else {
+	  skip = (GBool)visitedResources[ref0.num];
+	  visitedResources[ref0.num] = 1;
+	}
       }
       if (!skip) {
 

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/SecurityHandler.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/SecurityHandler.cc	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/SecurityHandler.cc	2019-05-03 04:51:31 UTC (rev 50962)
@@ -235,7 +235,7 @@
     if (ownerKeyObj.getString()->getLength() != 32 ||
 	userKeyObj.getString()->getLength() != 32) {
       error(errSyntaxError, -1, "Invalid encryption key length");
-      goto done;
+      // this is non-fatal -- see below
     }
   } else if (encRevision <= 6) {
     // the spec says 48 bytes, but Acrobat pads them out longer
@@ -252,6 +252,16 @@
   permFlags = permObj.getInt();
   ownerKey = ownerKeyObj.getString()->copy();
   userKey = userKeyObj.getString()->copy();
+  if (encRevision <= 4) {
+    // Adobe apparently zero-pads the U value (and maybe the O value?)
+    // if it's short
+    while (ownerKey->getLength() < 32) {
+      ownerKey->append((char)0x00);
+    }
+    while (userKey->getLength() < 32) {
+      userKey->append((char)0x00);
+    }
+  }
   if (encVersion >= 1 && encVersion <= 2 &&
       encRevision >= 2 && encRevision <= 3) {
     if (fileIDObj.isArray()) {

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.cc	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.cc	2019-05-03 04:51:31 UTC (rev 50962)
@@ -4175,8 +4175,8 @@
 
   if (str->getKind() == strJPX &&
       *width * *height > 10000000) {
-    sw = (double)*width / (fabs(ctm[2]) + fabs(ctm[3]));
-    sh = (double)*height / (fabs(ctm[0]) + fabs(ctm[1]));
+    sw = (double)*width / (fabs(ctm[0]) + fabs(ctm[1]));
+    sh = (double)*height / (fabs(ctm[2]) + fabs(ctm[3]));
     if (sw > 8 && sh > 8) {
       reduction = 3;
     } else if (sw > 4 && sh > 4) {

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/config.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/config.h	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/config.h	2019-05-03 04:51:31 UTC (rev 50962)
@@ -14,14 +14,14 @@
 //------------------------------------------------------------------------
 
 // xpdf version
-#define xpdfVersion          "4.01"
+#define xpdfVersion          "4.01.01"
 #define xpdfVersionNum       4.01
 #define xpdfMajorVersion     4
 #define xpdfMinorVersion     1
-#define xpdfUpdateVersion    0
+#define xpdfUpdateVersion    1
 #define xpdfMajorVersionStr  "4"
 #define xpdfMinorVersionStr  "1"
-#define xpdfUpdateVersionStr "0"
+#define xpdfUpdateVersionStr "1"
 
 // supported PDF version
 #define supportedPDFVersionStr "2.0"
@@ -31,7 +31,7 @@
 #define xpdfCopyright "Copyright 1996-2019 Glyph & Cog, LLC"
 
 // Windows resource file stuff
-#define winxpdfVersion "WinXpdf 4.01"
+#define winxpdfVersion "WinXpdf 4.01.01"
 #define xpdfCopyrightAmp "Copyright 1996-2019 Glyph && Cog, LLC"
 
 //------------------------------------------------------------------------

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdffonts.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdffonts.cc	2019-05-03 04:30:21 UTC (rev 50961)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdffonts.cc	2019-05-03 04:51:31 UTC (rev 50962)
@@ -46,6 +46,7 @@
 static void scanFonts(Object *obj, PDFDoc *doc);
 static void scanFonts(Dict *resDict, PDFDoc *doc);
 static void scanFont(GfxFont *font, PDFDoc *doc);
+static GBool checkObject(Object *in, Object *out);
 
 static int firstPage = 1;
 static int lastPage = 0;
@@ -85,16 +86,16 @@
   {NULL}
 };
 
+static PDFDoc *doc;
+
 static Ref *fonts;
 static int fontsLen;
 static int fontsSize;
 
-static Ref *seenObjs;
-static int seenObjsLen;
-static int seenObjsSize;
+static char *seenObjs;
+static int numObjects;
 
 int main(int argc, char *argv[]) {
-  PDFDoc *doc;
   char *fileName;
   GString *ownerPW, *userPW;
   GBool ok;
@@ -166,8 +167,9 @@
   }
   fonts = NULL;
   fontsLen = fontsSize = 0;
-  seenObjs = NULL;
-  seenObjsLen = seenObjsSize = 0;
+  numObjects = doc->getXRef()->getNumObjects();
+  seenObjs = (char *)gmalloc(numObjects);
+  memset(seenObjs, 0, numObjects);
   for (pg = firstPage; pg <= lastPage; ++pg) {
     page = doc->getCatalog()->getPage(pg);
     if ((resDict = page->getResourceDict())) {
@@ -220,27 +222,8 @@
 
 static void scanFonts(Object *obj, PDFDoc *doc) {
   Object obj2;
-  int i;
 
-  if (obj->isRef()) {
-    for (i = 0; i < seenObjsLen; ++i) {
-      if (obj->getRefNum() == seenObjs[i].num &&
-	  obj->getRefGen() == seenObjs[i].gen) {
-	return;
-      }
-    }
-    if (seenObjsLen == seenObjsSize) {
-      if (seenObjsSize <= INT_MAX - 32) {
-	seenObjsSize += 32;
-      } else {
-	// let greallocn throw an exception
-	seenObjsSize = -1;
-      }
-      seenObjs = (Ref *)greallocn(seenObjs, seenObjsSize, sizeof(Ref));
-    }
-    seenObjs[seenObjsLen++] = obj->getRef();
-  }
-  if (obj->fetch(doc->getXRef(), &obj2)->isDict()) {
+  if (checkObject(obj, &obj2) && obj2.isDict()) {
     scanFonts(obj2.getDict(), doc);
   }
   obj2.free();
@@ -247,8 +230,10 @@
 }
 
 static void scanFonts(Dict *resDict, PDFDoc *doc) {
-  Object obj1, obj2, xObjDict, xObj;
-  Object patternDict, pattern, gsDict, gs, smask, smaskGroup, resObj;
+  Object fontDict1, fontDict2, xObjDict1, xObjDict2, xObj1, xObj2;
+  Object patternDict1, patternDict2, pattern1, pattern2;
+  Object gsDict1, gsDict2, gs1, gs2, smask1, smask2, smaskGroup1, smaskGroup2;
+  Object resObj;
   Ref r;
   GfxFontDict *gfxFontDict;
   GfxFont *font;
@@ -256,79 +241,90 @@
 
   // scan the fonts in this resource dictionary
   gfxFontDict = NULL;
-  resDict->lookupNF("Font", &obj1);
-  if (obj1.isRef()) {
-    obj1.fetch(doc->getXRef(), &obj2);
-    if (obj2.isDict()) {
-      r = obj1.getRef();
-      gfxFontDict = new GfxFontDict(doc->getXRef(), &r, obj2.getDict());
+  resDict->lookupNF("Font", &fontDict1);
+  if (checkObject(&fontDict1, &fontDict2) && fontDict2.isDict()) {
+    if (fontDict1.isRef()) {
+      r = fontDict1.getRef();
+      gfxFontDict = new GfxFontDict(doc->getXRef(), &r, fontDict2.getDict());
+    } else {
+      gfxFontDict = new GfxFontDict(doc->getXRef(), NULL, fontDict2.getDict());
     }
-    obj2.free();
-  } else if (obj1.isDict()) {
-    gfxFontDict = new GfxFontDict(doc->getXRef(), NULL, obj1.getDict());
-  }
-  if (gfxFontDict) {
-    for (i = 0; i < gfxFontDict->getNumFonts(); ++i) {
-      if ((font = gfxFontDict->getFont(i))) {
-	scanFont(font, doc);
+    if (gfxFontDict) {
+      for (i = 0; i < gfxFontDict->getNumFonts(); ++i) {
+	if ((font = gfxFontDict->getFont(i))) {
+	  scanFont(font, doc);
+	}
       }
+      delete gfxFontDict;
     }
-    delete gfxFontDict;
   }
-  obj1.free();
+  fontDict2.free();
+  fontDict1.free();
 
   // recursively scan any resource dictionaries in XObjects in this
   // resource dictionary
-  resDict->lookup("XObject", &xObjDict);
-  if (xObjDict.isDict()) {
-    for (i = 0; i < xObjDict.dictGetLength(); ++i) {
-      xObjDict.dictGetVal(i, &xObj);
-      if (xObj.isStream()) {
-	xObj.streamGetDict()->lookupNF("Resources", &resObj);
+  resDict->lookupNF("XObject", &xObjDict1);
+  if (checkObject(&xObjDict1, &xObjDict2) && xObjDict2.isDict()) {
+    for (i = 0; i < xObjDict2.dictGetLength(); ++i) {
+      xObjDict2.dictGetValNF(i, &xObj1);
+      if (checkObject(&xObj1, &xObj2) && xObj2.isStream()) {
+	xObj2.streamGetDict()->lookupNF("Resources", &resObj);
 	scanFonts(&resObj, doc);
 	resObj.free();
       }
-      xObj.free();
+      xObj2.free();
+      xObj1.free();
     }
   }
-  xObjDict.free();
+  xObjDict2.free();
+  xObjDict1.free();
 
   // recursively scan any resource dictionaries in Patterns in this
   // resource dictionary
-  resDict->lookup("Pattern", &patternDict);
-  if (patternDict.isDict()) {
-    for (i = 0; i < patternDict.dictGetLength(); ++i) {
-      patternDict.dictGetVal(i, &pattern);
-      if (pattern.isStream()) {
-	pattern.streamGetDict()->lookupNF("Resources", &resObj);
+  resDict->lookupNF("Pattern", &patternDict1);
+  if (checkObject(&patternDict1, &patternDict2) && patternDict2.isDict()) {
+    for (i = 0; i < patternDict2.dictGetLength(); ++i) {
+      patternDict2.dictGetValNF(i, &pattern1);
+      if (checkObject(&pattern1, &pattern2) && pattern2.isStream()) {
+	pattern2.streamGetDict()->lookupNF("Resources", &resObj);
 	scanFonts(&resObj, doc);
 	resObj.free();
       }
-      pattern.free();
+      pattern2.free();
+      pattern1.free();
     }
   }
-  patternDict.free();
+  patternDict2.free();
+  patternDict1.free();
 
   // recursively scan any resource dictionaries in ExtGStates in this
   // resource dictionary
-  resDict->lookup("ExtGState", &gsDict);
-  if (gsDict.isDict()) {
-    for (i = 0; i < gsDict.dictGetLength(); ++i) {
-      if (gsDict.dictGetVal(i, &gs)->isDict()) {
-	if (gs.dictLookup("SMask", &smask)->isDict()) {
-	  if (smask.dictLookup("G", &smaskGroup)->isStream()) {
-	    smaskGroup.streamGetDict()->lookupNF("Resources", &resObj);
+  resDict->lookupNF("ExtGState", &gsDict1);
+  if (checkObject(&gsDict1, &gsDict2) && gsDict2.isDict()) {
+    for (i = 0; i < gsDict2.dictGetLength(); ++i) {
+      gsDict1.dictGetValNF(i, &gs1);
+      if (checkObject(&gs1, &gs2) && gs2.isDict()) {
+	gs2.dictLookupNF("SMask", &smask1);
+	if (checkObject(&smask1, &smask2) && smask2.isDict()) {
+	  smask2.dictLookupNF("G", &smaskGroup1);
+	  if (checkObject(&smaskGroup1, &smaskGroup2) &&
+	      smaskGroup2.isStream()) {
+	    smaskGroup2.streamGetDict()->lookupNF("Resources", &resObj);
 	    scanFonts(&resObj, doc);
 	    resObj.free();
 	  }
-	  smaskGroup.free();
+	  smaskGroup2.free();
+	  smaskGroup1.free();
 	}
-	smask.free();
+	smask2.free();
+	smask1.free();
       }
-      gs.free();
+      gs2.free();
+      gs1.free();
     }
   }
-  gsDict.free();
+  gsDict2.free();
+  gsDict1.free();
 }
 
 static void scanFont(GfxFont *font, PDFDoc *doc) {
@@ -432,3 +428,24 @@
   }
   fonts[fontsLen++] = *font->getID();
 }
+
+static GBool checkObject(Object *in, Object *out) {
+  int objNum;
+
+  if (!in->isRef()) {
+    in->copy(out);
+    return gTrue;
+  }
+  objNum = in->getRefNum();
+  if (objNum < 0 || objNum >= numObjects) {
+    out->initNull();
+    return gTrue;
+  }
+  if (seenObjs[objNum]) {
+    out->initNull();
+    return gFalse;
+  }
+  seenObjs[objNum] = (char)1;
+  in->fetch(doc->getXRef(), out);
+  return gTrue;
+}



More information about the tex-live-commits mailing list