You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2014/04/29 07:55:03 UTC
svn commit: r1590874 -
/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java
Author: tilman
Date: Tue Apr 29 05:55:03 2014
New Revision: 1590874
URL: http://svn.apache.org/r1590874
Log:
PDFBOX-2048: handle stream that incorrectly claims to have length 0
Modified:
pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java
Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java?rev=1590874&r1=1590873&r2=1590874&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java Tue Apr 29 05:55:03 2014
@@ -288,7 +288,7 @@ public class COSStream extends COSDictio
// in case we need it later
long writtenLength = unFilteredStream.getLengthWritten();
- if( length == 0 )
+ if (length == 0 && writtenLength == 0)
{
//if the length is zero then don't bother trying to decode
//some filters don't work when attempting to decode
@@ -302,7 +302,7 @@ public class COSStream extends COSDictio
//ok this is a simple hack, sometimes we read a couple extra
//bytes that shouldn't be there, so we encounter an error we will just
//try again with one less byte.
- for( int tryCount=0; !done && tryCount<5; tryCount++ )
+ for (int tryCount = 0; length > 0 && !done && tryCount < 5; tryCount++)
{
InputStream input = null;
try