File poppler-CVE-2022-37051.patch of Package poppler.30682
Index: poppler-0.43.0/utils/pdfunite.cc
===================================================================
--- poppler-0.43.0.orig/utils/pdfunite.cc
+++ poppler-0.43.0/utils/pdfunite.cc
@@ -244,6 +244,14 @@ int main (int argc, char *argv[])
if (docs.size() >= 1) {
Object catObj;
docs[0]->getXRef()->getCatalog(&catObj);
+ if(!catObj.isDict()){
+ fclose(f);
+ delete yRef;
+ delete countRef;
+ delete outStr;
+ error(errSyntaxError, -1, "XRef's Catalog is not a dictionary.");
+ return -1;
+ }
Dict *catDict = catObj.getDict();
catDict->lookup("OutputIntents", &intents);
catDict->lookupNF("AcroForm", &afObj);
@@ -366,6 +374,14 @@ int main (int argc, char *argv[])
}
Object pageCatObj, pageNames;
docs[i]->getXRef()->getCatalog(&pageCatObj);
+ if(!pageCatObj.isDict()){
+ fclose(f);
+ delete yRef;
+ delete countRef;
+ delete outStr;
+ error(errSyntaxError, -1, "XRef's Catalog is not a dictionary.");
+ return -1;
+ }
Dict *pageCatDict = pageCatObj.getDict();
pageCatDict->lookup("Names", &pageNames);
if (!pageNames.isNull() && pageNames.isDict()) {