[poppler] 2 commits - poppler/Catalog.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Wed Jul 15 14:59:41 PDT 2015


 poppler/Catalog.cc |   34 +++++++++++++++++++---------------
 1 file changed, 19 insertions(+), 15 deletions(-)

New commits:
commit 0ce4da8ab16b4a5497688a6cf86175aaec0f585f
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Jul 15 23:59:11 2015 +0200

    Make sure pageRootRef is a ref before using it
    
    Bug #91344

diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index 9603024..44a972e 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -828,21 +828,25 @@ int Catalog::getNumPages()
 	error(errSyntaxError, -1, "Pages top-level is a single Page. The document is mal-formed, trying to recover...");
 
 	Dict *pageDict = pagesDict.getDict();
-	const Ref pageRef = pageRootRef.getRef();
-	Page *p = new Page(doc, 1, pageDict, pageRef, new PageAttrs(NULL, pageDict), form);
-	if (p->isOk()) {
-	  pages = (Page **)gmallocn(1, sizeof(Page *));
-	  pageRefs = (Ref *)gmallocn(1, sizeof(Ref));
-
-	  pages[0] = p;
-	  pageRefs[0].num = pageRef.num;
-	  pageRefs[0].gen = pageRef.gen;
-
-	  numPages = 1;
-	  lastCachedPage = 1;
-	  pagesSize = 1;
+	if (pageRootRef.isRef()) {
+	  const Ref pageRef = pageRootRef.getRef();
+	  Page *p = new Page(doc, 1, pageDict, pageRef, new PageAttrs(NULL, pageDict), form);
+	  if (p->isOk()) {
+	    pages = (Page **)gmallocn(1, sizeof(Page *));
+	    pageRefs = (Ref *)gmallocn(1, sizeof(Ref));
+
+	    pages[0] = p;
+	    pageRefs[0].num = pageRef.num;
+	    pageRefs[0].gen = pageRef.gen;
+
+	    numPages = 1;
+	    lastCachedPage = 1;
+	    pagesSize = 1;
+	  } else {
+	    delete p;
+	    numPages = 0;
+	  }
 	} else {
-	  delete p;
 	  numPages = 0;
 	}
       } else {
commit b71431513b45f8a1aa4154332dae56af241258f8
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Jul 15 13:10:27 2015 +0200

    Typo fix in warning

diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index f75f4e1..9603024 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -825,7 +825,7 @@ int Catalog::getNumPages()
 	Object pageRootRef;
 	catDict.dictLookupNF("Pages", &pageRootRef);
 
-	error(errSyntaxError, -1, "Pages top-level is a single Page. The document is mal-formet, trying to recover...");
+	error(errSyntaxError, -1, "Pages top-level is a single Page. The document is mal-formed, trying to recover...");
 
 	Dict *pageDict = pagesDict.getDict();
 	const Ref pageRef = pageRootRef.getRef();


More information about the poppler mailing list