From 6dfe52db3481d8ef2f4eb3872444a2144c5ccf5d Mon Sep 17 00:00:00 2001 From: Marek Kasik Date: Fri, 8 Mar 2019 18:18:28 +0100 Subject: [PATCH] Synchronize previous patch with upstream Related: #1665274 --- poppler-0.73.0-check-catalog-is-dict.patch | 43 ++++++++++++++++------ poppler.spec | 6 ++- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/poppler-0.73.0-check-catalog-is-dict.patch b/poppler-0.73.0-check-catalog-is-dict.patch index f4b86eb..9c55d6d 100644 --- a/poppler-0.73.0-check-catalog-is-dict.patch +++ b/poppler-0.73.0-check-catalog-is-dict.patch @@ -1,27 +1,46 @@ +From 7b4e372deeb716eb3fe3a54b31ed41af759224f9 Mon Sep 17 00:00:00 2001 +From: Marek Kasik +Date: Mon, 4 Mar 2019 12:55:12 +0100 +Subject: [PATCH] pdfunite: Check XRef's Catalog for being a Dict + +Check whether Catalog from XRef is Dict for each document +passed to pdfunite and return error if not. + +https://gitlab.freedesktop.org/poppler/poppler/issues/706 +--- + utils/pdfunite.cc | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + diff --git a/utils/pdfunite.cc b/utils/pdfunite.cc -index 61613f60..462fb00c 100644 +index b0142116..23888684 100644 --- a/utils/pdfunite.cc +++ b/utils/pdfunite.cc -@@ -165,7 +165,7 @@ int main (int argc, char *argv[]) +@@ -165,7 +165,8 @@ int main (int argc, char *argv[]) for (i = 1; i < argc - 1; i++) { GooString *gfileName = new GooString(argv[i]); PDFDoc *doc = new PDFDoc(gfileName, nullptr, nullptr, nullptr); - if (doc->isOk() && !doc->isEncrypted()) { -+ if (doc->isOk() && !doc->isEncrypted() && doc->getXRef()->getCatalog().isDict()) { ++ if (doc->isOk() && !doc->isEncrypted() && ++ doc->getXRef()->getCatalog().isDict()) { docs.push_back(doc); if (doc->getPDFMajorVersion() > majorVersion) { majorVersion = doc->getPDFMajorVersion(); -@@ -175,9 +175,12 @@ int main (int argc, char *argv[]) - minorVersion = doc->getPDFMinorVersion(); +@@ -176,8 +177,13 @@ int main (int argc, char *argv[]) } } -- } else if (doc->isOk()) { -+ } else if (doc->isEncrypted()) { - error(errUnimplemented, -1, "Could not merge encrypted files ('{0:s}')", argv[i]); - return -1; -+ } else if (!doc->getXRef()->getCatalog().isDict()) { -+ error(errSyntaxError, -1, "Catalog is not a dictionary ('{0:s}')", argv[i]); -+ return -1; + } else if (doc->isOk()) { +- error(errUnimplemented, -1, "Could not merge encrypted files ('{0:s}')", argv[i]); +- return -1; ++ if (doc->isEncrypted()) { ++ error(errUnimplemented, -1, "Could not merge encrypted files ('{0:s}')", argv[i]); ++ return -1; ++ } else if (!doc->getXRef()->getCatalog().isDict()) { ++ error(errSyntaxError, -1, "XRef's Catalog is not a dictionary ('{0:s}')", argv[i]); ++ return -1; ++ } } else { error(errSyntaxError, -1, "Could not merge damaged documents ('{0:s}')", argv[i]); return -1; +-- +2.20.1 + diff --git a/poppler.spec b/poppler.spec index 436d968..ae97ebd 100644 --- a/poppler.spec +++ b/poppler.spec @@ -4,7 +4,7 @@ Summary: PDF rendering library Name: poppler Version: 0.73.0 -Release: 4%{?dist} +Release: 5%{?dist} License: (GPLv2 or GPLv3) and GPLv2+ and LGPLv2+ and MIT URL: http://poppler.freedesktop.org/ Source0: http://poppler.freedesktop.org/poppler-%{version}.tar.xz @@ -258,6 +258,10 @@ test "$(pkg-config --modversion poppler-splash)" = "%{version}" %{_mandir}/man1/* %changelog +* Fri Mar 8 2019 Marek Kasik - 0.73.0-5 +- Synchronize previous patch with upstream +- Related: #1665274 + * Wed Feb 20 2019 Marek Kasik - 0.73.0-4 - Check Catalog from XRef for being a Dict - Resolves: #1665274