summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2023-09-11 23:37:06 +0200
committerAlbert Astals Cid <tsdgeos@yahoo.es>2023-09-12 20:54:55 +0000
commitc44c25ea36a0bf33b6ba46d16ab922dcc13f591e (patch)
tree73d2c7fe56131c8cf36f02e536a9707ffed108cd
parent1223c1eb42c62d1587d929b8c72ad8513f0e4b7d (diff)
PDFDoc::savePageAs: Return cleanly if page is not a dict
-rw-r--r--poppler/PDFDoc.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 64746edd..ae69f690 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -924,6 +924,14 @@ int PDFDoc::savePageAs(const GooString &name, int pageNo)
return errDamaged;
}
+ if (!page.isDict()) {
+ fclose(f);
+ delete yRef;
+ delete countRef;
+ delete outStr;
+ error(errSyntaxError, -1, "page is not a dictionary");
+ return errOpenFile;
+ }
Dict *pageDict = page.getDict();
if (resourcesObj.isNull() && !pageDict->hasKey("Resources")) {
Object *resourceDictObject = getCatalog()->getPage(pageNo)->getResourceDictObject();