This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug java/14446] GZIPInputStream: corrupted gzip file - crc mismatch


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]