File CVE-2019-7310.patch of Package poppler.27868

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(+)

Index: poppler-0.62.0/poppler/XRef.cc
===================================================================
--- poppler-0.62.0.orig/poppler/XRef.cc	2021-11-23 08:21:42.756715591 +0100
+++ poppler-0.62.0/poppler/XRef.cc	2021-11-23 08:21:42.828714200 +0100
@@ -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) {
openSUSE Build Service is sponsored by