--- texlive-base-20190410/source/texk/web2c/pdftexdir/pdftoepdf.cc
+++ texlive-base-20190410/source/texk/web2c/pdftexdir/pdftoepdf.cc
@@ -26,6 +26,15 @@ The poppler should be 0.59.0 or newer ve
 POPPLER_VERSION should be defined.
 */
 
+#ifdef POPPLER_VERSION
+#include <poppler-config.h>
+#define xpdfVersion POPPLER_VERSION
+#define xpdfString "poppler"
+#else
+#include <xpdf/config.h>        /* just to get the xpdf version */
+#define xpdfString "xpdf"
+#endif
+
 /* Do this early in order to avoid a conflict between
    MINGW32 <rpcndr.h> defining 'boolean' as 'unsigned char' and
    <kpathsea/types.h> defining Pascal's boolean as 'int'.
@@ -292,7 +292,7 @@ static void copyDictEntry(Object * obj,
     Object obj1;
     copyName(obj->dictGetKey(i));
     pdf_puts(" ");
-    obj1 = obj->dictGetValNF(i);
+    obj1 = obj->dictGetValNF(i).copy();
     copyObject(&obj1);
     pdf_puts("\n");
 }
@@ -351,7 +351,7 @@ static void copyProcSet(Object * obj)
                     obj->getTypeName());
     pdf_puts("/ProcSet [ ");
     for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
-        procset = obj->arrayGetNF(i);
+        procset = obj->arrayGetNF(i).copy();
         if (!procset.isName())
             pdftex_fail("PDF inclusion: invalid ProcSet entry type <%s>",
                         procset.getTypeName());
@@ -406,7 +406,7 @@ static void copyFont(const char *tag, Ob
     if (fontdict.isDict()) {
         subtype = fontdict.dictLookup("Subtype");
         basefont = fontdict.dictLookup("BaseFont");
-        fontdescRef = fontdict.dictLookupNF("FontDescriptor");
+        fontdescRef = fontdict.dictLookupNF("FontDescriptor").copy();
         if (fontdescRef.isRef()) {
             fontdesc = fontdescRef.fetch(xref);
         }
@@ -452,7 +452,7 @@ static void copyFontResources(Object * o
                     obj->getTypeName());
     pdf_puts("/Font << ");
     for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
-        fontRef = obj->dictGetValNF(i);
+        fontRef = obj->dictGetValNF(i).copy();
         if (fontRef.isRef())
             copyFont(obj->dictGetKey(i), &fontRef);
         else if (fontRef.isDict()) {   // some programs generate pdf with embedded font object
@@ -595,7 +595,7 @@ static void copyObject(Object * obj)
     } else if (obj->isArray()) {
         pdf_puts("[");
         for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
-            obj1 = obj->arrayGetNF(i);
+            obj1 = obj->arrayGetNF(i).copy();
             if (!obj1.isName())
                 pdf_puts(" ");
             copyObject(&obj1);
@@ -723,7 +723,7 @@ read_pdf_info(char *image_name, char *pa
 #endif
     // initialize
     if (!isInit) {
-        globalParams = new GlobalParams();
+        globalParams = std::unique_ptr<GlobalParams>(new GlobalParams());
         globalParams->setErrQuiet(false);
         isInit = true;
     }
@@ -761,7 +761,7 @@ read_pdf_info(char *image_name, char *pa
         if (link == 0 || !link->isOk())
             pdftex_fail("PDF inclusion: invalid destination <%s>", page_name);
         Ref ref = link->getPageRef();
-        page_num = pdf_doc->doc->getCatalog()->findPage(ref.num, ref.gen);
+        page_num = pdf_doc->doc->getCatalog()->findPage(ref);
         if (page_num == 0)
             pdftex_fail("PDF inclusion: destination is not a page <%s>",
                         page_name);
@@ -921,13 +921,13 @@ void write_epdf(void)
     pdf_puts(stripzeros(s));
 
     // Metadata validity check (as a stream it must be indirect)
-    dictObj = pageDict->lookupNF("Metadata");
+    dictObj = pageDict->lookupNF("Metadata").copy();
     if (!dictObj.isNull() && !dictObj.isRef())
         pdftex_warn("PDF inclusion: /Metadata must be indirect object");
 
     // copy selected items in Page dictionary except Resources & Group
     for (i = 0; pageDictKeys[i] != NULL; i++) {
-        dictObj = pageDict->lookupNF(pageDictKeys[i]);
+        dictObj = pageDict->lookupNF(pageDictKeys[i]).copy();
         if (!dictObj.isNull()) {
             pdf_newline();
             pdf_printf("/%s ", pageDictKeys[i]);
@@ -936,7 +936,7 @@ void write_epdf(void)
     } 
 
     // handle page group
-    dictObj = pageDict->lookupNF("Group");
+    dictObj = pageDict->lookupNF("Group").copy();
     if (!dictObj.isNull()) {
         if (pdfpagegroupval == 0) { 
             // another pdf with page group was included earlier on the
@@ -978,7 +978,7 @@ The changes below seem to work fine.
             l = dic1.getLength();
             for (i = 0; i < l; i++) {
                 groupDict.dictAdd(dic1.getKey(i),
-                                  dic1.getValNF(i));
+                                  dic1.getValNF(i).copy());
             }
 // end modification
             pdf_printf("/Group %ld 0 R\n", (long)pdfpagegroupval);
@@ -1108,6 +1108,6 @@ void epdf_check_mem()
             delete_document(p);
         }
         // see above for globalParams
-        delete globalParams;
+        globalParams.reset();
     }
 }
--- texlive-base-20190410/source/texk/web2c/pdftexdir/pdftosrc.cc
+++ texlive-base-20190410/source/texk/web2c/pdftexdir/pdftosrc.cc
@@ -24,6 +24,15 @@ by Arch Linux. The poppler should be 0.5
 POPPLER_VERSION should be defined.
 */
 
+#ifdef POPPLER_VERSION
+#include <poppler-config.h>
+#define xpdfVersion POPPLER_VERSION
+#define xpdfString "poppler"
+#else
+#include <xpdf/config.h>        /* just to get the xpdf version */
+#define xpdfString "xpdf"
+#endif
+
 #include <w2c/config.h>
 
 #include <stdlib.h>
@@ -79,7 +79,7 @@ int main(int argc, char *argv[])
         exit(1);
     }
     fileName = new GString(argv[1]);
-    globalParams = new GlobalParams();
+    globalParams = std::unique_ptr<GlobalParams>(new GlobalParams());
     doc = new PDFDoc(fileName);
     if (!doc->isOk()) {
         fprintf(stderr, "Invalid PDF file\n");
@@ -100,7 +100,7 @@ int main(int argc, char *argv[])
     if (objnum == 0) {
         srcStream = catalogDict.dictLookup("SourceObject");
         static char const_SourceFile[] = "SourceFile";
-        if (!srcStream.isStream(const_SourceFile)) {
+        if (!(srcStream.isStream() && srcStream.getDict()->is(const_SourceFile))) {
             fprintf(stderr, "No SourceObject found\n");
             exit(1);
         }
@@ -156,7 +156,6 @@ int main(int argc, char *argv[])
                         (e->type == xrefEntryFree ? "f" : "n"));
             else {              // e->offset is the object number of the object stream
                 Stream *str;
-                Lexer *lexer;
                 Parser *parser;
                 Object objStr, obj1, obj2;
                 int nObjects, first, n;
@@ -174,8 +173,7 @@ int main(int argc, char *argv[])
                 // parse the header: object numbers and offsets
                 objStr.streamReset();
                 str = new EmbedStream(objStr.getStream(), Object(objNull), true, first);
-                lexer = new Lexer(xref, str);
-                parser = new Parser(xref, lexer, false);
+                parser = new Parser(xref, str, false);
                 for (n = 0; n < nObjects; ++n) {
                     obj1 = parser->getObj();
                     obj2 = parser->getObj();
@@ -207,5 +207,5 @@ int main(int argc, char *argv[])
         fprintf(stderr, "Cross-reference table extracted to %s\n", outname);
     fclose(outfile);
     delete doc;
-    delete globalParams;
+    globalParams.reset();
 }
--- texlive-base-20190410/source/texk/web2c/pdftexdir/utils.c
+++ texlive-base-20190410/source/texk/web2c/pdftexdir/utils.c
@@ -32,14 +32,6 @@ with this program.  If not, see <http://
 #include <zlib.h>
 #include "ptexlib.h"
 #include <png.h>
-#ifdef POPPLER_VERSION
-#include <poppler-config.h>
-#define xpdfVersion POPPLER_VERSION
-#define xpdfString "poppler"
-#else
-#include <xpdf/config.h>        /* just to get the xpdf version */
-#define xpdfString "xpdf"
-#endif
 
 #define check_nprintf(size_get, size_want) \
     if ((unsigned)(size_get) >= (unsigned)(size_want)) \
@@ -977,12 +969,10 @@ void initversionstring(char **versions)
 {
     const_string fmt =
                     "Compiled with libpng %s; using libpng %s\n"
-                    "Compiled with zlib %s; using zlib %s\n"
-                    "Compiled with %s version %s\n";
+                    "Compiled with zlib %s; using zlib %s\n";
     size_t len = strlen(fmt)
                     + strlen(PNG_LIBPNG_VER_STRING) + strlen(png_libpng_ver)
                     + strlen(ZLIB_VERSION) + strlen(zlib_version)
-                    + strlen(xpdfString) + strlen(xpdfVersion)
                     + 1;
 
     /* len will be more than enough, because of the placeholder chars in fmt
@@ -990,7 +980,7 @@ void initversionstring(char **versions)
     *versions = xmalloc(len);
     sprintf(*versions, fmt,
                     PNG_LIBPNG_VER_STRING, png_libpng_ver,
-                    ZLIB_VERSION, zlib_version, xpdfString, xpdfVersion);
+                    ZLIB_VERSION, zlib_version);
 }
 
 
--- texlive-base-20190410/source/texk/web2c/xetexdir/XeTeX_ext.c
+++ texlive-base-20190410/source/texk/web2c/xetexdir/XeTeX_ext.c
@@ -38,7 +38,6 @@ authorization from the copyright holders
 
 #include <w2c/config.h>
 
-#include <poppler-config.h>
 #include <png.h>
 #include <zlib.h>
 #include <graphite2/Font.h>
@@ -167,7 +166,6 @@ void initversionstring(char **versions)
         "Compiled with Graphite2 version %d.%d.%d; using %d.%d.%d\n"
         "Compiled with HarfBuzz version %s; using %s\n"
         "Compiled with libpng version %s; using %s\n"
-        "Compiled with poppler version %s\n"
 #ifdef XETEX_MAC
         "Using Mac OS X Core Text and Cocoa frameworks\n"
 #else
@@ -184,7 +182,6 @@ void initversionstring(char **versions)
             + strlen(hb_version_string())
             + strlen(PNG_LIBPNG_VER_STRING)
             + strlen(png_libpng_ver)
-            + strlen(POPPLER_VERSION)
 #ifndef XETEX_MAC
             + 6 * 3 /* for fontconfig version #s (won't really need 3 digits per field!) */
 #endif
@@ -214,7 +211,7 @@ void initversionstring(char **versions)
         GR2_VERSION_MAJOR, GR2_VERSION_MINOR, GR2_VERSION_BUGFIX,
         grMajor, grMinor, grBugfix,
         HB_VERSION_STRING, hb_version_string(),
-        PNG_LIBPNG_VER_STRING, png_libpng_ver, POPPLER_VERSION
+        PNG_LIBPNG_VER_STRING, png_libpng_ver
 #ifndef XETEX_MAC
         ,
         FC_VERSION / 10000, (FC_VERSION % 10000) / 100, FC_VERSION % 100,
