[poppler] poppler/Outline.cc poppler/Outline.h

Albert Astals Cid aacid at kemper.freedesktop.org
Wed Nov 23 19:27:12 UTC 2016


 poppler/Outline.cc |   18 ++++--------------
 poppler/Outline.h  |    4 ++--
 2 files changed, 6 insertions(+), 16 deletions(-)

New commits:
commit 0c9c2089f52de5bb08717518c439fa8bbb99011f
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Nov 23 20:22:17 2016 +0100

    Fix Outline parsing on broken documents
    
    Broken documents in which the parent "Last" pointer is earlier than the siblings "Next" pointer
    
    This mimics Adobe Reader behaviour.
    
    Bug #98732

diff --git a/poppler/Outline.cc b/poppler/Outline.cc
index 707ffdb..bf46be2 100644
--- a/poppler/Outline.cc
+++ b/poppler/Outline.cc
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Marco Pesenti Gritti <mpg at redhat.com>
-// Copyright (C) 2008 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008, 2016 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009 Nick Jones <nick.jones at network-box.com>
 // Copyright (C) 2016 Jason Crain <jason at aquaticape.us>
 //
@@ -47,9 +47,7 @@ Outline::Outline(Object *outlineObj, XRef *xref) {
   if (!outlineObj->isDict()) {
     return;
   }
-  items = OutlineItem::readItemList(outlineObj->dictLookupNF("First", &first),
-				    outlineObj->dictLookupNF("Last", &last),
-				    xref);
+  items = OutlineItem::readItemList(outlineObj->dictLookupNF("First", &first), xref);
   first.free();
   last.free();
 }
@@ -115,17 +113,13 @@ OutlineItem::~OutlineItem() {
   nextRef.free();
 }
 
-GooList *OutlineItem::readItemList(Object *firstItemRef, Object *lastItemRef,
-				 XRef *xrefA) {
+GooList *OutlineItem::readItemList(Object *firstItemRef, XRef *xrefA) {
   GooList *items;
   char* alreadyRead;
   OutlineItem *item;
   Object obj;
   Object *p;
 
-  if (!lastItemRef->isRef())
-    return NULL;
-
   items = new GooList();
 
   alreadyRead = (char *)gmalloc(xrefA->getNumObjects());
@@ -144,10 +138,6 @@ GooList *OutlineItem::readItemList(Object *firstItemRef, Object *lastItemRef,
     item = new OutlineItem(obj.getDict(), xrefA);
     obj.free();
     items->append(item);
-    if (p->getRef().num == lastItemRef->getRef().num &&
-	p->getRef().gen == lastItemRef->getRef().gen) {
-      break;
-    }
     p = &item->nextRef;
   }
 
@@ -163,7 +153,7 @@ GooList *OutlineItem::readItemList(Object *firstItemRef, Object *lastItemRef,
 
 void OutlineItem::open() {
   if (!kids) {
-    kids = readItemList(&firstRef, &lastRef, xref);
+    kids = readItemList(&firstRef, xref);
   }
 }
 
diff --git a/poppler/Outline.h b/poppler/Outline.h
index 90190e6..46775d5 100644
--- a/poppler/Outline.h
+++ b/poppler/Outline.h
@@ -14,6 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Marco Pesenti Gritti <mpg at redhat.com>
+// Copyright (C) 2016 Albert Astals Cid <aacid at kde.org>
 //
 // 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
@@ -59,8 +60,7 @@ public:
   OutlineItem(Dict *dict, XRef *xrefA);
   ~OutlineItem();
 
-  static GooList *readItemList(Object *firstItemRef, Object *lastItemRef,
-			     XRef *xrefA);
+  static GooList *readItemList(Object *firstItemRef, XRef *xrefA);
 
   void open();
   void close();


More information about the poppler mailing list