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/05/16 12:51:52 UTC

svn commit: r1877812 - in /pdfbox/branches/2.0: ./ pdfbox/ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PNGConverter.java

Author: lehmi
Date: Sat May 16 12:51:52 2020
New Revision: 1877812

URL: http://svn.apache.org/viewvc?rev=1877812&view=rev
Log:
PDFBOX-4071: implement MultipleInputStream.read() to avoid Exception in FlateFilter

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/pdmodel/graphics/image/PNGConverter.java

Propchange: pdfbox/branches/2.0/
------------------------------------------------------------------------------
  Merged /pdfbox/trunk:r1877811

Propchange: pdfbox/branches/2.0/pdfbox/
------------------------------------------------------------------------------
  Merged /pdfbox/trunk/pdfbox:r1877811

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PNGConverter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PNGConverter.java?rev=1877812&r1=1877811&r2=1877812&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PNGConverter.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PNGConverter.java Sat May 16 12:51:52 2020
@@ -512,7 +512,17 @@ final class PNGConverter
         @Override
         public int read() throws IOException
         {
-            throw new IllegalStateException("Only bulk reads are expected!");
+            if (!ensureStream())
+            {
+                return -1;
+            }
+            int ret = currentStream.read();
+            if (ret == -1)
+            {
+                currentStream = null;
+                return read();
+            }
+            return ret;
         }
 
         @Override