pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1810995 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
Date Tue, 03 Oct 2017 12:08:36 GMT
Author: lehmi
Date: Tue Oct  3 12:08:35 2017
New Revision: 1810995

URL: http://svn.apache.org/viewvc?rev=1810995&view=rev
Log:
PDFBOX-3949: avoid NPE, skip incomplete streams

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java?rev=1810995&r1=1810994&r2=1810995&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java Tue
Oct  3 12:08:35 2017
@@ -1695,9 +1695,16 @@ public class COSParser extends BaseParse
         // add all found compressed objects to the brute force search result
         for (Long offset : bfSearchObjStreamsOffsets.keySet())
         {
-            long bfOffset = bfSearchCOSObjectKeyOffsets.get(bfSearchObjStreamsOffsets.get(offset));
+            Long bfOffset = bfSearchCOSObjectKeyOffsets.get(bfSearchObjStreamsOffsets.get(offset));
+            // incomplete object stream found?
+            if (bfOffset == null)
+            {
+                LOG.warn("Skipped incomplete object stream:" + bfSearchObjStreamsOffsets.get(offset)
+                        + " at " + offset);
+                continue;
+            }
             // check if the object was overwritten
-            if (offset == bfOffset)
+            if (offset.equals(bfOffset))
             {
                 source.seek(offset);
                 long stmObjNumber = readObjectNumber();



Mime
View raw message