File poppler-CVE-2025-50420.patch of Package poppler.40038

From 08d7894e4dd0e313c179e30f06ad8f546619b1b3 Mon Sep 17 00:00:00 2001
From: Sune Vuorela <sune@vuorela.dk>
Date: Tue, 29 Jul 2025 14:14:00 +0200
Subject: [PATCH] Fix crash in pdfseparate

Don't continue recursing in PDFDoc::mark* if things looks a bit weirder
than expected
---
 poppler/PDFDoc.cc | 9 +++++++++
 1 file changed, 9 insertions(+)

Index: poppler-0.43.0/poppler/PDFDoc.cc
===================================================================
--- poppler-0.43.0.orig/poppler/PDFDoc.cc
+++ poppler-0.43.0/poppler/PDFDoc.cc
@@ -1745,6 +1745,16 @@ GBool PDFDoc::markAnnotations(Object *an
           Object type;
           Dict *dict = obj1.getDict();
           dict->lookup("Type", &type);
+          if (type.isNull()) {
+              Object subType;
+              dict->lookup("SubType", &type);
+              // Type is optional, subtype is required
+              // If neither of them exists, something is probably
+              // weird here, so let us just skip this entry
+              if (subType.isNull()) {
+                  continue;
+              }
+          }
           if (type.isName() && strcmp(type.getName(), "Annot") == 0) {
             Object obj2;
             if (dict->lookupNF("P", &obj2)->isRef()) {
openSUSE Build Service is sponsored by