diff --git a/poppler/XRef.cc b/poppler/XRef.cc index 1bbbdc5..f920860 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -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..56231ef 100644 --- a/poppler/XRef.h +++ b/poppler/XRef.h @@ -201,6 +201,7 @@ private: int rootNum, rootGen; // catalog dict GBool ok; // true if xref table is valid int errCode; // error code (if is false) + GBool xrefReconstructed; // marker, true if xref was already reconstructed Object trailerDict; // trailer dictionary Goffset *streamEnds; // 'endstream' positions - only used in // damaged files