pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1844520 - in /pdfbox/trunk: ./ pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
Date Sun, 21 Oct 2018 20:30:50 GMT
Author: lehmi
Date: Sun Oct 21 20:30:50 2018
New Revision: 1844520

URL: http://svn.apache.org/viewvc?rev=1844520&view=rev
Log:
PDFBOX-4354: avoid NumberFormatException

Modified:
    pdfbox/trunk/   (props changed)
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java   (contents,
props changed)

Propchange: pdfbox/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 21 20:30:50 2018
@@ -1,3 +1,3 @@
-/pdfbox/branches/2.0:1760418,1761484,1762133,1763609,1779822,1780783,1780789,1782684,1784450,1792784,1795704,1795712,1799081-1799082,1814046,1814285,1814459,1824914,1825811,1825820,1825912,1844477,1844516
+/pdfbox/branches/2.0:1760418,1761484,1762133,1763609,1779822,1780783,1780789,1782684,1784450,1792784,1795704,1795712,1799081-1799082,1814046,1814285,1814459,1824914,1825811,1825820,1825912,1844477,1844516,1844519
 /pdfbox/branches/no-awt:1618517-1621410
 /pdfbox/no-awt:1618514-1618516

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java?rev=1844520&r1=1844519&r2=1844520&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java Sun Oct 21
20:30:50 2018
@@ -2019,13 +2019,20 @@ public class COSParser extends BaseParse
                 Map<COSObjectKey, Long> xrefOffset = xrefTrailerResolver.getXrefTable();
                 for (int i = 0; i < nrOfObjects; i++)
                 {
-                    long objNumber = Long.parseLong(numbers[i * 2]);
-                    COSObjectKey objKey = new COSObjectKey(objNumber, 0);
-                    Long existingOffset = bfSearchCOSObjectKeyOffsets.get(objKey);
-                    if (existingOffset == null || offset > existingOffset)
+                    try
                     {
-                        bfSearchCOSObjectKeyOffsets.put(objKey, -stmObjNumber);
-                        xrefOffset.put(objKey, -stmObjNumber);
+                        long objNumber = Long.parseLong(numbers[i * 2]);
+                        COSObjectKey objKey = new COSObjectKey(objNumber, 0);
+                        Long existingOffset = bfSearchCOSObjectKeyOffsets.get(objKey);
+                        if (existingOffset == null || offset > existingOffset)
+                        {
+                            bfSearchCOSObjectKeyOffsets.put(objKey, -stmObjNumber);
+                            xrefOffset.put(objKey, -stmObjNumber);
+                        }
+                    }
+                    catch (NumberFormatException exception)
+                    {
+                        LOG.debug("Skipped corrupt object key in stream: " + stmObjNumber);
                     }
                 }
             }

Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 21 20:30:50 2018
@@ -1,4 +1,4 @@
 /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java:1641458
-/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java:1779822,1780783,1792784,1792839,1795704,1795712,1811482,1813367,1814459,1844516
+/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java:1779822,1780783,1792784,1792839,1795704,1795712,1811482,1813367,1814459,1844516,1844519
 /pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java:1618517-1621410
 /pdfbox/no-awt/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java:1618514-1618516



Mime
View raw message