[poppler] utils/pdfunite.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 29 20:51:13 UTC 2022


 utils/pdfunite.cc |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

New commits:
commit 4631115647c1e4f0482ffe0491c2f38d2231337b
Author: crt <chluo at cse.cuhk.edu.hk>
Date:   Fri Jul 29 20:51:11 2022 +0000

    Check isDict before calling getDict
    
    Issue #1276

diff --git a/utils/pdfunite.cc b/utils/pdfunite.cc
index b96b0378..050927d3 100644
--- a/utils/pdfunite.cc
+++ b/utils/pdfunite.cc
@@ -197,6 +197,14 @@ int main(int argc, char *argv[])
     Object ocObj;
     if (docs.size() >= 1) {
         Object catObj = docs[0]->getXRef()->getCatalog();
+        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();
         intents = catDict->lookup("OutputIntents");
         afObj = catDict->lookupNF("AcroForm").copy();
@@ -295,6 +303,14 @@ int main(int argc, char *argv[])
             }
         }
         Object pageCatObj = docs[i]->getXRef()->getCatalog();
+        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();
         Object pageNames = pageCatDict->lookup("Names");
         if (!pageNames.isNull() && pageNames.isDict()) {


More information about the poppler mailing list