Patch: `long' Overflows in java/util/zip/ZipEntry.java

Bryce McKinlay bryce@albatross.co.nz
Sat Apr 1 00:00:00 GMT 2000


I checked in this trivial patch to fix a couple of long->int overflows.

2000-02-19  Bryce McKinlay  <bryce@albatross.co.nz>

        * java/util/zip/ZipEntry.java (setCrc): Fix overflow.
        (setSize): ditto.

Index: ZipEntry.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/util/zip/ZipEntry.java,v
retrieving revision 1.6
diff -u -r1.6 ZipEntry.java
--- ZipEntry.java       2000/01/19 18:39:27     1.6
+++ ZipEntry.java       2000/02/19 02:49:15
@@ -94,7 +94,7 @@

   public void setCrc (long crc)
   {
-    if (crc < 0 || crc > 0xffffffff)
+    if (crc < 0 || crc > 0xffffffffL)
       throw new IllegalArgumentException ();
     this.crc = crc;
   }
@@ -115,7 +115,7 @@

   public void setSize (long size)
   {
-    if (size < 0 || size > 0xffffffff)
+    if (size < 0 || size > 0xffffffffL)
       throw new IllegalArgumentException ();
     this.size = size;
   }




More information about the Java mailing list