pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r992278 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java
Date Fri, 03 Sep 2010 12:30:19 GMT
Author: jukka
Date: Fri Sep  3 12:30:19 2010
New Revision: 992278

URL: http://svn.apache.org/viewvc?rev=992278&view=rev
Log:
PDFBOX-808: PDTrueTypeFont.loadTTF() freezes

Break the potential endless loop reported by Martin Hilpert.

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java?rev=992278&r1=992277&r2=992278&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java Fri Sep 
3 12:30:19 2010
@@ -189,11 +189,10 @@ public abstract class TTFDataStream 
         byte[] data = new byte[ numberOfBytes ];
         int amountRead = 0;
         int totalAmountRead = 0;
-        while( (amountRead = read( data, totalAmountRead, numberOfBytes-totalAmountRead )
) != -1 && 
-               totalAmountRead < numberOfBytes )
-        {
+        //read at most numberOfBytes bytes from the stream.
+        while (totalAmountRead < numberOfBytes
+                && (amountRead = read( data, totalAmountRead, numberOfBytes-totalAmountRead
) ) != -1) {
             totalAmountRead += amountRead;
-            //read at most numberOfBytes bytes from the stream.
         }
         return data;
     }



Mime
View raw message