You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2020/06/20 15:18:55 UTC

svn commit: r1879042 - in /pdfbox/branches/issue45: ./ pdfbox/ pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFXrefStreamParser.java

Author: lehmi
Date: Sat Jun 20 15:18:55 2020
New Revision: 1879042

URL: http://svn.apache.org/viewvc?rev=1879042&view=rev
Log:
PDFBOX-4894: use long instead of int for object offset as proposed by Carl Grundstrom

Modified:
    pdfbox/branches/issue45/   (props changed)
    pdfbox/branches/issue45/pdfbox/   (props changed)
    pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFXrefStreamParser.java

Propchange: pdfbox/branches/issue45/
------------------------------------------------------------------------------
  Merged /pdfbox/trunk:r1879041
  Merged /pdfbox/branches/2.0:r1879041

Propchange: pdfbox/branches/issue45/pdfbox/
------------------------------------------------------------------------------
  Merged /pdfbox/branches/2.0/pdfbox:r1879041

Modified: pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFXrefStreamParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFXrefStreamParser.java?rev=1879042&r1=1879041&r2=1879042&view=diff
==============================================================================
--- pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFXrefStreamParser.java (original)
+++ pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFXrefStreamParser.java Sat Jun 20 15:18:55 2020
@@ -155,10 +155,10 @@ public class PDFXrefStreamParser extends
                      */
                     break;
                 case 1:
-                    int offset = 0;
+                    long offset = 0;
                     for(int i = 0; i < w1; i++)
                     {
-                        offset += (currLine[i + w0] & 0x00ff) << ((w1 - i - 1) * 8);
+                        offset += ((long) currLine[i + w0] & 0x00ff) << ((w1 - i - 1) * 8);
                     }
                     int genNum = 0;
                     for(int i = 0; i < w2; i++)
@@ -179,10 +179,10 @@ public class PDFXrefStreamParser extends
                      * table but add object stream number with minus sign in order to
                      * distinguish from file offsets
                      */
-                    int objstmObjNr = 0;
+                    long objstmObjNr = 0;
                     for(int i = 0; i < w1; i++)
                     {
-                        objstmObjNr += (currLine[i + w0] & 0x00ff) << ((w1 - i - 1) * 8);
+                        objstmObjNr += ((long) currLine[i + w0] & 0x00ff) << ((w1 - i - 1) * 8);
                     }    
                     objKey = new COSObjectKey( objID, 0 );
                     xrefTrailerResolver.setXRef( objKey, -objstmObjNr );