bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22641] java.util.zip.InflaterInputStream broken for zero-


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22641] java.util.zip.InflaterInputStream broken for zero-length reads
Date: 16 Oct 2005 01:26:11 -0000

The java.util.zip.InflaterInputStream.read(byte[],int,int) method does not work
correctly for zero-length reads.  These cause Inflater.inflate() to be called
with len == 0, which results in an IllegalArgumentException.

Here is an obvious fix:
diff -u -r1.4 InflaterInputStream.java
--- java/util/zip/InflaterInputStream.java      2002/06/17 17:10:56     1.4
+++ java/util/zip/InflaterInputStream.java      2002/07/02 14:13:57
@@ -182,6 +182,10 @@
    */
   public int read(byte[] b, int off, int len) throws IOException
   {
+    // Special case for zero-length reads.
+    if (len == 0)
+      return 0;
+
     for (;;)
       {
        int count;


------- Comment #1 from from-classpath at savannah dot gnu dot org  2002-07-05 
21:30 -------
Fixed.  I changed the check in Inflater.inflate(byte[],int,int)
instead.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22641





reply via email to

[Prev in Thread] Current Thread [Next in Thread]