[PATCH] Fix crash in pdfseparate
authorSune Vuorela <sune@vuorela.dk>
Tue, 29 Jul 2025 12:14:00 +0000 (14:14 +0200)
committerSalvatore Bonaccorso <carnil@debian.org>
Sun, 12 Oct 2025 18:30:50 +0000 (20:30 +0200)
Don't continue recursing in PDFDoc::mark* if things looks a bit weirder
than expected

Gbp-Pq: Name CVE-2025-50420.patch

poppler/PDFDoc.cc

index 118c4692d49b4f2fb5f1cf789e3af7de79585177..5a2fb245abd889e5d9d1cd1c4c8291da3652a0ec 100644 (file)
@@ -1857,6 +1857,15 @@ bool PDFDoc::markAnnotations(Object *annotsObj, XRef *xRef, XRef *countRef, unsi
             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()) {