re PR java/14446 (GZIPInputStream: corrupted gzip file - crc mismatch)

PR libgcj/14446:
	* java/util/zip/GZIPInputStream.java (read): Avoid sign extension
	when comparing CRCs.
	* java/util/zip/InflaterInputStream.java (onebytebuffer): New
	field.
	(read()): New overload.

From-SVN: r87882
This commit is contained in:
Tom Tromey
2004-09-22 20:16:17 +00:00
committed by Tom Tromey
parent 9b270cce93
commit ecd16bf665
3 changed files with 28 additions and 1 deletions
+3 -1
View File
@@ -230,7 +230,9 @@ public class GZIPInputStream
tmp[i] = (byte) eof_read();
}
int header_crc = read4(tmp, 0);
// Be careful to avoid sign extension here; CRC32.getValue()
// returns a long.
long header_crc = read4(tmp, 0) & 0xffffffffL;
if (crc.getValue() != header_crc)
throw new ZipException("corrupted gzip file - crc mismatch");
int isize = read4(tmp, 4);