Fixed wrong byte order in gzip crc32 and isize field
This commit is contained in:
parent
05525065b2
commit
8b7efa5db4
@ -1656,10 +1656,14 @@ final class Deflate {
|
|||||||
break;
|
break;
|
||||||
case GZIP:
|
case GZIP:
|
||||||
// Write the gzip trailer (CRC32 & ISIZE)
|
// Write the gzip trailer (CRC32 & ISIZE)
|
||||||
putShortMSB(strm.crc32 >>> 16);
|
put_byte((byte) (strm.crc32 & 0xFF));
|
||||||
putShortMSB(strm.crc32 & 0xFFFF);
|
put_byte((byte) (strm.crc32 >>> 8 & 0xFF));
|
||||||
putShortMSB(gzipUncompressedBytes >>> 16); // ISIZE 1
|
put_byte((byte) (strm.crc32 >>> 16 & 0xFF));
|
||||||
putShortMSB(gzipUncompressedBytes & 0xFFFF); // ISIZE 2
|
put_byte((byte) (strm.crc32 >>> 24 & 0xFF));
|
||||||
|
put_byte((byte) (gzipUncompressedBytes & 0xFF));
|
||||||
|
put_byte((byte) (gzipUncompressedBytes >>> 8 & 0xFF));
|
||||||
|
put_byte((byte) (gzipUncompressedBytes >>> 16 & 0xFF));
|
||||||
|
put_byte((byte) (gzipUncompressedBytes >>> 24 & 0xFF));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ final class Inflate {
|
|||||||
z.avail_in --;
|
z.avail_in --;
|
||||||
z.total_in ++;
|
z.total_in ++;
|
||||||
gzipBytesToRead --;
|
gzipBytesToRead --;
|
||||||
z.istate.gzipCRC32 = z.istate.gzipCRC32 << 8 | z.next_in[z.next_in_index ++] & 0xff;
|
z.istate.gzipCRC32 |= (z.next_in[z.next_in_index ++] & 0xff) << (3 - gzipBytesToRead) * 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (z.crc32 != z.istate.gzipCRC32) {
|
if (z.crc32 != z.istate.gzipCRC32) {
|
||||||
@ -519,7 +519,7 @@ final class Inflate {
|
|||||||
z.avail_in --;
|
z.avail_in --;
|
||||||
z.total_in ++;
|
z.total_in ++;
|
||||||
gzipBytesToRead --;
|
gzipBytesToRead --;
|
||||||
z.istate.gzipISize = z.istate.gzipISize << 8 | z.next_in[z.next_in_index ++] & 0xff;
|
z.istate.gzipISize |= (z.next_in[z.next_in_index ++] & 0xff) << (3 - gzipBytesToRead) * 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gzipUncompressedBytes != z.istate.gzipISize) {
|
if (gzipUncompressedBytes != z.istate.gzipISize) {
|
||||||
|
Loading…
Reference in New Issue
Block a user