Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates-src > by-pkgid > 616f517cd9d4be7b6c770b454aab19da > files > 29

poppler-0.52.0-3.11.mga6.src.rpm

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

diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index 6e0198c..0d10065 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -1618,6 +1618,11 @@ DummyXRefEntry dummyXRefEntry;
 
 XRefEntry *XRef::getEntry(int i, GBool 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) {