summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Kucharski <jakubkucharski97@gmail.com>2016-08-01 01:10:18 +0200
committerAlbert Astals Cid <aacid@kde.org>2016-08-01 23:05:46 +0200
commit0889366a5872316919dbb640b6cc5cda85295169 (patch)
tree62b258c051c6d3f128c0b7ecf4fe279aaff06fe7
parent7ba975630e12a3242d73372a685e016101c5e479 (diff)
XRef::createDocInfoIfNoneExists(): don't presume that DocInfo is a dictionary
In case a PDF document doesn't comply with the PDF reference and its DocInfo object isn't a dictionary, remove it and create a dictionary in its place.
-rw-r--r--poppler/XRef.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index f88c632c..75fa52d8 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -1295,8 +1295,12 @@ Object *XRef::getDocInfoNF(Object *obj) {
Object *XRef::createDocInfoIfNoneExists(Object *obj) {
getDocInfo(obj);
- if (!obj->isNull()) {
+ if (obj->isDict()) {
return obj;
+ } else if (!obj->isNull()) {
+ // DocInfo exists, but isn't a dictionary (doesn't comply with the PDF reference)
+ obj->free();
+ removeDocInfo();
}
obj->initDict(this);