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

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-22.01.0/poppler/PDFDoc.cc
===================================================================
--- poppler-22.01.0.orig/poppler/PDFDoc.cc
+++ poppler-22.01.0/poppler/PDFDoc.cc
@@ -1840,6 +1840,15 @@ bool PDFDoc::markAnnotations(Object *ann
             if (obj1.isDict()) {
                 Dict *dict = obj1.getDict();
                 Object type = dict->lookup("Type");
+                if (type.isNull()) {
+                    Object subType = dict->lookup("SubType");
+                    // 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) {
                     const Object &obj2 = dict->lookupNF("P");
                     if (obj2.isRef()) {
openSUSE Build Service is sponsored by