pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1794892 - in /pdfbox/branches/2.0: ./ pdfbox/ pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
Date Thu, 11 May 2017 20:50:21 GMT
Author: lehmi
Date: Thu May 11 20:50:21 2017
New Revision: 1794892

URL: http://svn.apache.org/viewvc?rev=1794892&view=rev
Log:
PDFBOX-3788: avoid negative seek offset

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

Propchange: pdfbox/branches/2.0/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 11 20:50:21 2017
@@ -1,3 +1,3 @@
 /pdfbox/branches/no-awt:1618517-1621410
 /pdfbox/no-awt:1618514-1618516
-/pdfbox/trunk:1736223,1736227,1736615,1737043,1737130,1737599-1737600,1738755,1740160,1742437,1742442,1743248,1745595,1745606,1745772,1745774,1745776,1745779,1746032,1746151,1749162,1749165,1749432,1766088,1766213,1767585,1768061,1770985,1770988,1772528,1778172,1782679,1786586,1786603,1787546,1790745,1794073,1794090,1794620,1794753,1794859
+/pdfbox/trunk:1736223,1736227,1736615,1737043,1737130,1737599-1737600,1738755,1740160,1742437,1742442,1743248,1745595,1745606,1745772,1745774,1745776,1745779,1746032,1746151,1749162,1749165,1749432,1766088,1766213,1767585,1768061,1770985,1770988,1772528,1778172,1782679,1786586,1786603,1787546,1790745,1794073,1794090,1794620,1794753,1794859,1794891

Propchange: pdfbox/branches/2.0/pdfbox/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 11 20:50:21 2017
@@ -1,3 +1,3 @@
 /pdfbox/branches/no-awt/pdfbox:1618517-1621410
 /pdfbox/no-awt/pdfbox:1618514-1618516
-/pdfbox/trunk/pdfbox:1736223,1736227,1736615,1737043,1737130,1737599-1737600,1738755,1740160,1742437,1742442,1743248,1745595,1745606,1745772,1745774,1745776,1745779,1746032,1746151,1749162,1749165,1749432,1757165,1758817,1767585,1770988,1772528,1778172,1782679,1786586,1786603,1787546,1790745,1794073,1794090,1794620,1794753,1794859
+/pdfbox/trunk/pdfbox:1736223,1736227,1736615,1737043,1737130,1737599-1737600,1738755,1740160,1742437,1742442,1743248,1745595,1745606,1745772,1745774,1745776,1745779,1746032,1746151,1749162,1749165,1749432,1757165,1758817,1767585,1770988,1772528,1778172,1782679,1786586,1786603,1787546,1790745,1794073,1794090,1794620,1794753,1794859,1794891

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=1794892&r1=1794891&r2=1794892&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 Thu
May 11 20:50:21 2017
@@ -402,11 +402,19 @@ public class COSParser extends BaseParse
             {
                 LOG.debug("Performing brute force search for last startxref entry");
                 long bfOffset = bfSearchForLastStartxrefEntry();
-                source.seek(bfOffset);
-                long bfXref = parseStartXref();
+                boolean offsetIsValid = false;
+                if (bfOffset > -1)
+                {
+                    source.seek(bfOffset);
+                    long bfXref = parseStartXref();
+                    if (bfXref > -1)
+                    {
+                        offsetIsValid = checkXRefOffset(bfXref) == bfXref;
+                    }
+                }
                 source.seek(0);
                 // use the new offset only if it is a valid pointer to a xref table
-                return checkXRefOffset(bfXref) == bfXref ? bfOffset : -1;
+                return offsetIsValid ? bfOffset : -1;
             }
             else
             {

Propchange: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 11 20:50:21 2017
@@ -1,4 +1,4 @@
 /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java:1641458
 /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
-/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java:1737043,1737130,1738755,1778172,1782679,1786586,1787546,1794620,1794753,1794859
+/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java:1737043,1737130,1738755,1778172,1782679,1786586,1787546,1794620,1794753,1794859,1794891



Mime
View raw message