diff options
author | Jakub Kucharski <jakubkucharski97@gmail.com> | 2016-08-01 01:10:18 +0200 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2016-08-01 23:05:46 +0200 |
commit | 0889366a5872316919dbb640b6cc5cda85295169 (patch) | |
tree | 62b258c051c6d3f128c0b7ecf4fe279aaff06fe7 | |
parent | 7ba975630e12a3242d73372a685e016101c5e479 (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.cc | 6 |
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); |