Fix infinite loop in broken files

Resolves: #1699863
This commit is contained in:
Marek Kasik 2019-04-17 13:03:33 +02:00
parent 117c19cf2f
commit 856eb80a47
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,36 @@
From 8051f678b3b43326e5fdfd7c03f39de21059f426 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Fri, 5 Apr 2019 16:34:48 +0200
Subject: [PATCH] FontInfoScanner::scanFonts Fix infinite loop in broken files
Fixes #752
---
poppler/FontInfo.cc | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/poppler/FontInfo.cc b/poppler/FontInfo.cc
index 2c3be4c6..cd335771 100644
--- a/poppler/FontInfo.cc
+++ b/poppler/FontInfo.cc
@@ -144,7 +144,17 @@ void FontInfoScanner::scanFonts(XRef *xrefA, Dict *resDict, std::vector<FontInfo
Object obj2 = obj1.fetch(xrefA);
if (obj2.isStream()) {
- Object resObj = obj2.streamGetDict()->lookup("Resources");
+ Ref resourcesRef;
+ const Object resObj = obj2.streamGetDict()->lookup("Resources");
+
+ if (resourcesRef.num != -1) {
+ if (visitedObjects.find(resourcesRef.num) != visitedObjects.end()) {
+ continue;
+ }
+
+ visitedObjects.insert(resourcesRef.num);
+ }
+
if (resObj.isDict() && resObj.getDict() != resDict) {
scanFonts(xrefA, resObj.getDict(), fontsList);
}
--
2.20.1

View File

@ -4,7 +4,7 @@
Summary: PDF rendering library
Name: poppler
Version: 0.73.0
Release: 8%{?dist}
Release: 9%{?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
@ -38,6 +38,9 @@ Patch11: poppler-0.73.0-stack-overflow.patch
Patch12: poppler-0.73.0-coverage-values.patch
Patch13: poppler-0.73.0-rescale-filter.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1699862
Patch14: poppler-0.73.0-scan-fonts.patch
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: gettext-devel
@ -268,6 +271,10 @@ test "$(pkg-config --modversion poppler-splash)" = "%{version}"
%{_mandir}/man1/*
%changelog
* Wed Apr 17 2019 Marek Kasik <mkasik@redhat.com> - 0.73.0-9
- Fix infinite loop in broken files
- Resolves: #1699863
* Mon Apr 1 2019 Marek Kasik <mkasik@redhat.com> - 0.73.0-8
- Constrain number of cycles in rescale filter
- Compute correct coverage values for box filter