File r1648-Be-forgiving-when-reading-XRef-stream-content.patch of Package podofo.23799
------------------------------------------------------------------------
r1648 | aja_ | 2014-06-30 22:07:17 +0200 (lun, 30 jun 2014) | 7 lines
Be forgiving when reading XRef stream content
Just ignore ePdfError_NoNumber errors when reading XRef stream
content, which might happen for example when the stream points
to an offset where doesn't start any object. It might partly
return behaviour before r1587.
Index: src/base/PdfParser.cpp
===================================================================
--- src/base/PdfParser.cpp (revision 1647)
+++ src/base/PdfParser.cpp (revision 1648)
@@ -836,8 +836,18 @@
// Check for a previous XRef stream
if(xrefObject.HasPrevious())
{
- m_nIncrementalUpdates++;
- this->ReadXRefStreamContents( xrefObject.GetPreviousOffset(), bReadOnlyTrailer );
+ try {
+ m_nIncrementalUpdates++;
+ this->ReadXRefStreamContents( xrefObject.GetPreviousOffset(), bReadOnlyTrailer );
+ } catch(PdfError &e) {
+ /* Be forgiving, the error happens when an entry in XRef stream points
+ to a wrong place (offset) in the PDF file. */
+ if( e != ePdfError_NoNumber )
+ {
+ e.AddToCallstack( __FILE__, __LINE__ );
+ throw e;
+ }
+ }
}
}
------------------------------------------------------------------------