From fc0e40643eb2ee09914c06e757ed244e1598d335 Mon Sep 17 00:00:00 2001 From: Marek Kasik Date: Thu, 15 Nov 2018 14:39:57 +0100 Subject: [PATCH] Check for valid embedded file before trying to save it Resolves: #1649441 --- poppler-0.67.0-valid-embedded-file.patch | 46 ++++++++++++++++++++++++ poppler.spec | 9 ++++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 poppler-0.67.0-valid-embedded-file.patch diff --git a/poppler-0.67.0-valid-embedded-file.patch b/poppler-0.67.0-valid-embedded-file.patch new file mode 100644 index 0000000..1880a0d --- /dev/null +++ b/poppler-0.67.0-valid-embedded-file.patch @@ -0,0 +1,46 @@ +From 77a30e94d96220d7e22dff5b3f0a7f296f01b118 Mon Sep 17 00:00:00 2001 +From: Adam Reichold +Date: Tue, 6 Nov 2018 09:13:41 +0100 +Subject: [PATCH] pdfdetach: Check for valid embedded file before trying to + save it. + +Closes #661 +--- + utils/pdfdetach.cc | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/utils/pdfdetach.cc b/utils/pdfdetach.cc +index 846584a4..a8720c64 100644 +--- a/utils/pdfdetach.cc ++++ b/utils/pdfdetach.cc +@@ -251,7 +251,12 @@ int main(int argc, char *argv[]) { + } + *p = '\0'; + +- if (!fileSpec->getEmbeddedFile()->save(path)) { ++ auto *embFile = fileSpec->getEmbeddedFile(); ++ if (!embFile || !embFile->isOk()) { ++ exitCode = 3; ++ goto err2; ++ } ++ if (!embFile->save(path)) { + error(errIO, -1, "Error saving embedded file as '{0:s}'", p); + exitCode = 2; + goto err2; +@@ -296,7 +301,12 @@ int main(int argc, char *argv[]) { + p = path; + } + +- if (!fileSpec->getEmbeddedFile()->save(p)) { ++ auto *embFile = fileSpec->getEmbeddedFile(); ++ if (!embFile || !embFile->isOk()) { ++ exitCode = 3; ++ goto err2; ++ } ++ if (!embFile->save(p)) { + error(errIO, -1, "Error saving embedded file as '{0:s}'", p); + exitCode = 2; + goto err2; +-- +2.19.1 + diff --git a/poppler.spec b/poppler.spec index 462570d..c76748c 100644 --- a/poppler.spec +++ b/poppler.spec @@ -4,7 +4,7 @@ Summary: PDF rendering library Name: poppler Version: 0.67.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 @@ -31,6 +31,9 @@ Patch9: poppler-0.67.0-cycles-in-pdf-parsing.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1649435 Patch10: poppler-0.67.0-stream-check.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1649440 +Patch11: poppler-0.67.0-valid-embedded-file.patch + BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: gettext-devel @@ -261,6 +264,10 @@ test "$(pkg-config --modversion poppler-splash)" = "%{version}" %{_mandir}/man1/* %changelog +* Thu Nov 15 2018 Marek Kasik - 0.67.0-5 +- Check for valid embedded file before trying to save it +- Resolves: #1649441 + * Thu Nov 15 2018 Marek Kasik - 0.67.0-4 - Check for stream before calling stream methods - when saving an embedded file