pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1814285 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java
Date Sat, 04 Nov 2017 13:12:07 GMT
Author: lehmi
Date: Sat Nov  4 13:12:07 2017
New Revision: 1814285

URL: http://svn.apache.org/viewvc?rev=1814285&view=rev
Log:
PDFBOX-3990: detect another possible EOF while decompressing, removed assignment

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java?rev=1814285&r1=1814284&r2=1814285&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java
Sat Nov  4 13:12:07 2017
@@ -45,8 +45,8 @@ final class RunLengthDecodeFilter extend
             if (dupAmount <= 127)
             {
                 int amountToCopy = dupAmount + 1;
-                int compressedRead = 0;
-                while(amountToCopy > 0)
+                int compressedRead;
+                while (amountToCopy > 0)
                 {
                     compressedRead = encoded.read(buffer, 0, amountToCopy);
                     // EOF reached?
@@ -61,6 +61,11 @@ final class RunLengthDecodeFilter extend
             else
             {
                 int dupByte = encoded.read();
+                // EOF reached?
+                if (dupByte == -1)
+                {
+                    break;
+                }
                 for (int i = 0; i < 257 - dupAmount; i++)
                 {
                     decoded.write(dupByte);



Mime
View raw message