This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug java/14446] GZIPInputStream: corrupted gzip file - crc mismatch
- From: "sorabain at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Sep 2004 16:02:09 -0000
- Subject: [Bug java/14446] GZIPInputStream: corrupted gzip file - crc mismatch
- References: <20040305092750.14446.gcj@stuellenberg.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From sorabain at hotmail dot com 2004-09-22 16:02 -------
We had the same problem, and i found the cause:
java.util.zip.GZIPInputStream.java in libjava has a method called read4() that
reads in 4 bytes and returns them as an int (java integers are signed). this
is compared to CRC32.getValue(), which returns a long. The int is promoted to
a long for the comparison, but if the most significant (sign) bit is set this
will be a negative number, whereas the long with the same original low 32-bits
is positive. The comparison fails.
To fix it i just changed the return type of read4() to be a long in-line with
the type of CRC32.getValue()
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14446