From 150094281d4834f2dc4f422108bc0d284133c3a8 Mon Sep 17 00:00:00 2001 From: Marek Kasik Date: Fri, 9 Jun 2023 15:32:47 +0200 Subject: [PATCH] Check isDict before calling getDict Resolves: #2189823 --- poppler-20.11.0-pdfunite-check-isDict.patch | 41 +++++++++++++++++++++ poppler.spec | 9 ++++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 poppler-20.11.0-pdfunite-check-isDict.patch diff --git a/poppler-20.11.0-pdfunite-check-isDict.patch b/poppler-20.11.0-pdfunite-check-isDict.patch new file mode 100644 index 0000000..2ffdf72 --- /dev/null +++ b/poppler-20.11.0-pdfunite-check-isDict.patch @@ -0,0 +1,41 @@ +From 4631115647c1e4f0482ffe0491c2f38d2231337b Mon Sep 17 00:00:00 2001 +From: crt +Date: Fri, 29 Jul 2022 20:51:11 +0000 +Subject: Check isDict before calling getDict + +Issue #1276 + +diff --git a/utils/pdfunite.cc b/utils/pdfunite.cc +index b96b0378..050927d3 100644 +--- a/utils/pdfunite.cc ++++ b/utils/pdfunite.cc +@@ -197,6 +197,14 @@ int main(int argc, char *argv[]) + Object ocObj; + if (docs.size() >= 1) { + Object catObj = docs[0]->getXRef()->getCatalog(); ++ if(!catObj.isDict()){ ++ fclose(f); ++ delete yRef; ++ delete countRef; ++ delete outStr; ++ error(errSyntaxError, -1, "XRef's Catalog is not a dictionary."); ++ return -1; ++ } + Dict *catDict = catObj.getDict(); + intents = catDict->lookup("OutputIntents"); + afObj = catDict->lookupNF("AcroForm").copy(); +@@ -295,6 +303,14 @@ int main(int argc, char *argv[]) + } + } + Object pageCatObj = docs[i]->getXRef()->getCatalog(); ++ if(!pageCatObj.isDict()){ ++ fclose(f); ++ delete yRef; ++ delete countRef; ++ delete outStr; ++ error(errSyntaxError, -1, "XRef's Catalog is not a dictionary."); ++ return -1; ++ } + Dict *pageCatDict = pageCatObj.getDict(); + Object pageNames = pageCatDict->lookup("Names"); + if (!pageNames.isNull() && pageNames.isDict()) { diff --git a/poppler.spec b/poppler.spec index 0b0623f..a91025f 100644 --- a/poppler.spec +++ b/poppler.spec @@ -4,7 +4,7 @@ Summary: PDF rendering library Name: poppler Version: 20.11.0 -Release: 7%{?dist} +Release: 8%{?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 @@ -36,6 +36,9 @@ Patch25: poppler-20.11.0-jbig-symbol-overflow.patch # https://bugzilla.redhat.com/show_bug.cgi?id=2189815 Patch26: poppler-20.11.0-pdfunite-broken-document.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=2189811 +Patch27: poppler-20.11.0-pdfunite-check-isDict.patch + BuildRequires: cmake BuildRequires: gettext-devel BuildRequires: pkgconfig(cairo) @@ -240,6 +243,10 @@ test "$(pkg-config --modversion poppler-splash)" = "%{version}" %{_mandir}/man1/* %changelog +* Fri Jun 9 2023 Marek Kasik - 20.11.0-8 +- Check isDict before calling getDict +- Resolves: #2189823 + * Fri Jun 9 2023 Marek Kasik - 20.11.0-7 - Don't crash in broken documents - Resolves: #2189844