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 2009/03/26 11:13:45 UTC

svn commit: r758577 - /incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/cos/COSStream.java

Author: lehmi
Date: Thu Mar 26 10:13:39 2009
New Revision: 758577

URL: http://svn.apache.org/viewvc?rev=758577&view=rev
Log:
PDFBXO-443: prevent endless loop in doDecode. Thanks to Timo Boehme (timo dot boehme at ontochem dot com)

Modified:
    incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/cos/COSStream.java

Modified: incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/cos/COSStream.java
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/cos/COSStream.java?rev=758577&r1=758576&r2=758577&view=diff
==============================================================================
--- incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/cos/COSStream.java (original)
+++ incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/cos/COSStream.java Thu Mar 26 10:13:39 2009
@@ -253,6 +253,8 @@
         IOException exception = null;
         long position = unFilteredStream.getPosition();
         long length = unFilteredStream.getLength();
+        // in case we need it later
+        long writtenLength = unFilteredStream.getLengthWritten();  
 
         if( length == 0 )
         {
@@ -288,7 +290,7 @@
                 //if no good stream was found then lets try again but with the
                 //length of data that was actually read and not length
                 //defined in the dictionary
-                length = unFilteredStream.getLengthWritten();
+                length = writtenLength;
                 for( int tryCount=0; !done && tryCount<5; tryCount++ )
                 {
                     try