[poppler] poppler/XRef.cc poppler/XRef.h

Albert Astals Cid aacid at kemper.freedesktop.org
Wed Mar 16 09:37:32 UTC 2016


 poppler/XRef.cc |    8 +++++++-
 poppler/XRef.h  |    3 ++-
 2 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 57b7a52cc6b3675bfbff29ef20a509eadce091ac
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date:   Wed Mar 16 10:36:22 2016 +0100

    Fix rendering of some broken PDF files
    
    Call constructXRef if necessary xref can't be fetched and the PDF don't use xref streams
    
    Bug #92508

diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index 1bbbdc5..76ffc6f 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -20,7 +20,7 @@
 // Copyright (C) 2007 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2009, 2010 Ilya Gorenbein <igorenbein at finjan.com>
 // Copyright (C) 2010 Hib Eris <hib at hiberis.nl>
-// Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag at kabelmail.de>
+// Copyright (C) 2012, 2013, 2016 Thomas Freitag <Thomas.Freitag at kabelmail.de>
 // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2013, 2014 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2013 Pino Toscano <pino at kde.org>
@@ -297,6 +297,7 @@ void XRef::init() {
   ownerPasswordOk = gFalse;
   rootNum = -1;
   strOwner = gFalse;
+  xrefReconstructed = gFalse;
 }
 
 XRef::XRef() {
@@ -1249,6 +1250,11 @@ Object *XRef::fetch(int num, int gen, Object *obj, int recursion) {
   return obj;
 
  err:
+  if (!xRefStream && !xrefReconstructed) {
+    rootNum = -1;
+    constructXRef(&xrefReconstructed);
+    return fetch(num, gen, obj, ++recursion);
+  }
   return obj->initNull();
 }
 
diff --git a/poppler/XRef.h b/poppler/XRef.h
index 70065d8..8748cb4 100644
--- a/poppler/XRef.h
+++ b/poppler/XRef.h
@@ -19,7 +19,7 @@
 // Copyright (C) 2007 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2010 Ilya Gorenbein <igorenbein at finjan.com>
 // Copyright (C) 2010 Hib Eris <hib at hiberis.nl>
-// Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag at kabelmail.de>
+// Copyright (C) 2012, 2013, 2016 Thomas Freitag <Thomas.Freitag at kabelmail.de>
 // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
 //
@@ -201,6 +201,7 @@ private:
   int rootNum, rootGen;		// catalog dict
   GBool ok;			// true if xref table is valid
   int errCode;			// error code (if <ok> is false)
+  GBool xrefReconstructed;	// marker, true if xref was already reconstructed
   Object trailerDict;		// trailer dictionary
   Goffset *streamEnds;		// 'endstream' positions - only used in
 				//   damaged files


More information about the poppler mailing list