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

New commits:
commit 57b7a52cc6b3675bfbff29ef20a509eadce091ac
Author: Thomas Freitag <[email protected]>
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 <[email protected]>
 // Copyright (C) 2009, 2010 Ilya Gorenbein <[email protected]>
 // Copyright (C) 2010 Hib Eris <[email protected]>
-// Copyright (C) 2012, 2013 Thomas Freitag <[email protected]>
+// Copyright (C) 2012, 2013, 2016 Thomas Freitag <[email protected]>
 // Copyright (C) 2012, 2013 Fabio D'Urso <[email protected]>
 // Copyright (C) 2013, 2014 Adrian Johnson <[email protected]>
 // Copyright (C) 2013 Pino Toscano <[email protected]>
@@ -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 <[email protected]>
 // Copyright (C) 2010 Ilya Gorenbein <[email protected]>
 // Copyright (C) 2010 Hib Eris <[email protected]>
-// Copyright (C) 2012, 2013 Thomas Freitag <[email protected]>
+// Copyright (C) 2012, 2013, 2016 Thomas Freitag <[email protected]>
 // Copyright (C) 2012, 2013 Fabio D'Urso <[email protected]>
 // Copyright (C) 2013 Adrian Johnson <[email protected]>
 //
@@ -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
_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to