[poppler] poppler/Catalog.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Wed Nov 4 13:09:52 PST 2009


 poppler/Catalog.cc |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 55dd6024a4672a1787e8b1a8276bd78fff94e2cd
Author: Ilya Gorenbein <igorenbein at finjan.com>
Date:   Wed Nov 4 22:07:18 2009 +0100

    Do not error on files without "Count" and "Kids"
    
    It is not spec compliant not to have those fields but Adobe Reader and
    FoxIt seems to allow it so try to behave like them. See bug 24720
    to see why one would want such file

diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index 9a18e24..37a1062 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -22,6 +22,7 @@
 // Copyright (C) 2006, 2008 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2007 Julien Rebetez <julienr at svn.gnome.org>
 // Copyright (C) 2008 Pino Toscano <pino at kde.org>
+// Copyright (C) 2009 Ilya Gorenbein <igorenbein at finjan.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -99,9 +100,10 @@ Catalog::Catalog(XRef *xrefA) {
   if (!obj.isNum()) {
     error(-1, "Page count in top-level pages object is wrong type (%s)",
 	  obj.getTypeName());
-    goto err3;
+    pagesSize = numPages0 = 0;
+  } else {
+    pagesSize = numPages0 = (int)obj.getNum();
   }
-  pagesSize = numPages0 = (int)obj.getNum();
   obj.free();
   pages = (Page **)gmallocn(pagesSize, sizeof(Page *));
   pageRefs = (Ref *)gmallocn(pagesSize, sizeof(Ref));
@@ -216,8 +218,6 @@ Catalog::Catalog(XRef *xrefA) {
   catDict.free();
   return;
 
- err3:
-  obj.free();
  err2:
   pagesDict.free();
  err1:
@@ -292,7 +292,7 @@ int Catalog::readPageTree(Dict *pagesDict, PageAttrs *attrs, int start,
   if (!kids.isArray()) {
     error(-1, "Kids object (page %d) is wrong type (%s)",
 	  start+1, kids.getTypeName());
-    goto err1;
+    return start;
   }
   for (i = 0; i < kids.arrayGetLength(); ++i) {
     kids.arrayGetNF(i, &kidRef);


More information about the poppler mailing list