pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1767739 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
Date Wed, 02 Nov 2016 17:04:51 GMT
Author: tilman
Date: Wed Nov  2 17:04:51 2016
New Revision: 1767739

URL: http://svn.apache.org/viewvc?rev=1767739&view=rev
Log:
PDFBOX-3546: catch exception and skip incorrect XRefStm

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java?rev=1767739&r1=1767738&r2=1767739&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
(original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
Wed Nov  2 17:04:51 2016
@@ -582,12 +582,27 @@ public class NonSequentialPDFParser exte
                     fixedOffset = checkXRefOffset(streamOffset);
                     if (fixedOffset > -1 && fixedOffset != streamOffset)
                     {
+                        LOG.warn("/XRefStm offset " + streamOffset + " is incorrect, corrected
to " + fixedOffset);
                         streamOffset = (int)fixedOffset;
                         trailer.setInt(COSName.XREF_STM, streamOffset);
                     }
                     setPdfSource(streamOffset);
                     skipSpaces();
-                    parseXrefObjStream(prev, false); 
+                    try
+                    {
+                        parseXrefObjStream(prev, false);
+                    }
+                    catch (IOException ex)
+                    {
+                        if (isLenient)
+                        {
+                            LOG.error("Failed to parse /XRefStm at offset " + streamOffset,
ex);
+                        }
+                        else
+                        {
+                            throw ex;
+                        }
+                    }
                 }
                 prev = trailer.getInt(COSName.PREV);
                 if (prev > 0)



Mime
View raw message