[poppler] 3 commits - poppler/Catalog.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Sat Jun 4 05:24:41 PDT 2011
poppler/Catalog.cc | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
New commits:
commit db2ae1bdbb7fcb64ba4c91dfc574d9f970bebdf6
Author: Albert Astals Cid <aacid at kde.org>
Date: Sat Jun 4 13:23:11 2011 +0100
Make sure catDict is a dict
diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index 60006b9..a8c2e39 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -751,6 +751,11 @@ int Catalog::getNumPages()
Object catDict, pagesDict, obj;
xref->getCatalog(&catDict);
+ if (!catDict.isDict()) {
+ error(-1, "Catalog object is wrong type (%s)", catDict.getTypeName());
+ catDict.free();
+ return 0;
+ }
catDict.dictLookup("Pages", &pagesDict);
catDict.free();
commit 58915affbdf1b5780f25d172a582c69fb2413230
Author: Albert Astals Cid <aacid at kde.org>
Date: Sat Jun 4 13:20:02 2011 +0100
Make sure catDict is a dict before using it
KDE Bug 274888 shows it's possible to get aborts because of that
diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index 8c77ebf..60006b9 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -238,17 +238,23 @@ GBool Catalog::cachePageTree(int page)
xref->getCatalog(&catDict);
- Object pagesDictRef;
- if (catDict.dictLookupNF("Pages", &pagesDictRef)->isRef() &&
- pagesDictRef.getRefNum() >= 0 &&
- pagesDictRef.getRefNum() < xref->getNumObjects()) {
- pagesRef = pagesDictRef.getRef();
- pagesDictRef.free();
+ if (catDict.isDict()) {
+ Object pagesDictRef;
+ if (catDict.dictLookupNF("Pages", &pagesDictRef)->isRef() &&
+ pagesDictRef.getRefNum() >= 0 &&
+ pagesDictRef.getRefNum() < xref->getNumObjects()) {
+ pagesRef = pagesDictRef.getRef();
+ pagesDictRef.free();
+ } else {
+ error(-1, "Catalog dictionary does not contain a valid \"Pages\" entry");
+ pagesDictRef.free();
+ catDict.free();
+ return gFalse;
+ }
} else {
- error(-1, "Catalog dictionary does not contain a valid \"Pages\" entry");
- pagesDictRef.free();
- catDict.free();
- return gFalse;
+ error(-1, "Could not find catalog dictionary");
+ catDict.free();
+ return gFalse;
}
Object obj;
commit 4ebc7e364409fe303e7a5729b568913e3c92e7d4
Author: Albert Astals Cid <aacid at kde.org>
Date: Sat Jun 4 13:19:34 2011 +0100
We need to free catDict on failure
diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index bc4c5aa..8c77ebf 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -247,6 +247,7 @@ GBool Catalog::cachePageTree(int page)
} else {
error(-1, "Catalog dictionary does not contain a valid \"Pages\" entry");
pagesDictRef.free();
+ catDict.free();
return gFalse;
}
More information about the poppler
mailing list