Hi, kaffe!! 

I made patch for bug #756 that Jakartra-Ant (Java Build tool) doesn't
work with Kaffe. Error occurs when buffer length (len) is 0 at
write(byte[] buf, int off, int len) method  in
java/util/zip/ZipOutputStream.java and java/util/zip/DeflateOutputStream.java

My patch throw IndexOutOfBoundsException() when offset (off) and
length (len) are invalid, and exit method when length is 0.
(I refered SUN's java/util/zip/* and modified them.)

Ant will be one of most important software for Java. 
Please fix this problem.

regards.
------------------
Takashi Okamoto

-----------------------------
diff -urN orig/libraries/javalib/java/util/zip/DeflaterOutputStream.java 
libraries/javalib/java/util/zip/DeflaterOutputStream.java
--- orig/libraries/javalib/java/util/zip/DeflaterOutputStream.java      Wed Mar  7 
08:21:19 2001
+++ libraries/javalib/java/util/zip/DeflaterOutputStream.java   Wed Mar  7 08:09:32 
+2001
@@ -60,6 +60,11 @@
 }
 
 public void write(byte b[], int off, int len) throws IOException {
+        if ((off | len | (off + len) | (b.length - (off + len))) < 0) {
+         throw new IndexOutOfBoundsException();
+        } else if (len == 0) {
+         return;
+        }
        def.setInput(b, off, len);
        deflate();
 }
diff -urN orig/libraries/javalib/java/util/zip/ZipOutputStream.java 
libraries/javalib/java/util/zip/ZipOutputStream.java
--- orig/libraries/javalib/java/util/zip/ZipOutputStream.java   Wed Mar  7 08:20:57 
2001
+++ libraries/javalib/java/util/zip/ZipOutputStream.java        Wed Mar  7 08:11:38 
+2001
@@ -321,6 +321,13 @@
 
 public synchronized void write(byte[] buf, int off, int len) throws IOException
 {
+       if ((off < 0) || (off > buf.length) || (len < 0) ||
+            ((off + len) > buf.length) || ((off + len) < 0)) {
+            throw new IndexOutOfBoundsException();
+        } else if (len == 0) {
+            return;
+        }
+
        super.write(buf, off, len);
        crc.update(buf, off, len);
 }



Reply via email to