Defend against requests for negative XRef indices

Resolves: #1672420
This commit is contained in:
Marek Kasik 2019-02-20 16:15:50 +01:00
parent e6dbea09b9
commit db67326303
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,29 @@
From b54e1fc3e0d2600621a28d50f9f085b9e38619c2 Mon Sep 17 00:00:00 2001
From: Adam Reichold <adam.reichold@t-online.de>
Date: Fri, 1 Feb 2019 08:42:27 +0100
Subject: [PATCH] Also defend against requests for negative XRef indices.
oss-fuzz/12797
---
poppler/XRef.cc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index d042d1f4..ac2cd0ce 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -1565,6 +1565,11 @@ DummyXRefEntry dummyXRefEntry;
XRefEntry *XRef::getEntry(int i, bool complainIfMissing)
{
+ if (unlikely(i < 0)) {
+ error(errInternal, -1, "Request for invalid XRef entry [{0:d}]", i);
+ return &dummyXRefEntry;
+ }
+
if (i >= size || entries[i].type == xrefEntryNone) {
if ((!xRefStream) && mainXRefEntriesOffset) {
--
2.20.1

View File

@ -4,7 +4,7 @@
Summary: PDF rendering library
Name: poppler
Version: 0.73.0
Release: 2%{?dist}
Release: 3%{?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
@ -22,6 +22,9 @@ Patch6: poppler-0.63.0-tiling-patterns.patch
Patch7: poppler-0.67.0-qt4-const.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1672419
Patch8: poppler-0.73.0-negative-xref-indices.patch
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: gettext-devel
@ -252,6 +255,10 @@ test "$(pkg-config --modversion poppler-splash)" = "%{version}"
%{_mandir}/man1/*
%changelog
* Wed Feb 20 2019 Marek Kasik <mkasik@redhat.com> - 0.73.0-3
- Defend against requests for negative XRef indices
- Resolves: #1672420
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.73.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild