Check for stream before calling stream methods

when saving an embedded file

Resolves: #1649436
This commit is contained in:
Marek Kasik 2018-11-15 13:53:49 +01:00
parent 9bf292ca2a
commit f7feaa9474
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From 6912e06d9ab19ba28991b5cab3319d61d856bd6d Mon Sep 17 00:00:00 2001
From: Adam Reichold <adam.reichold@t-online.de>
Date: Tue, 6 Nov 2018 09:00:02 +0100
Subject: [PATCH] Check for stream before calling stream methods when saving an
embedded file.
Closes #659
---
poppler/FileSpec.cc | 3 +++
1 file changed, 3 insertions(+)
diff --git a/poppler/FileSpec.cc b/poppler/FileSpec.cc
index 7479c2d2..d5543041 100644
--- a/poppler/FileSpec.cc
+++ b/poppler/FileSpec.cc
@@ -93,6 +93,9 @@ bool EmbFile::save(const char *path) {
GBool EmbFile::save2(FILE *f) {
int c;
+ if (unlikely(!m_objStr.isStream()))
+ return false;
+
m_objStr.streamReset();
while ((c = m_objStr.streamGetChar()) != EOF) {
fputc(c, f);
--
2.19.1

View File

@ -4,7 +4,7 @@
Summary: PDF rendering library
Name: poppler
Version: 0.67.0
Release: 3%{?dist}
Release: 4%{?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
@ -28,6 +28,9 @@ Patch8: poppler-0.67.0-embedded-file-check.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1626618
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
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: gettext-devel
@ -258,6 +261,11 @@ test "$(pkg-config --modversion poppler-splash)" = "%{version}"
%{_mandir}/man1/*
%changelog
* Thu Nov 15 2018 Marek Kasik <mkasik@redhat.com> - 0.67.0-4
- Check for stream before calling stream methods
- when saving an embedded file
- Resolves: #1649436
* Mon Nov 12 2018 Marek Kasik <mkasik@redhat.com> - 0.67.0-3
- Avoid cycles in PDF parsing
- Resolves: #1626620