kopia lustrzana https://github.com/viljoviitanen/pako
Polished ungzip crc32 check
rodzic
1d91d3b187
commit
21c21df425
|
@ -1356,8 +1356,8 @@ function inflate(strm, flush) {
|
|||
while (bits < 32) {
|
||||
if (have === 0) { break inf_leave; }
|
||||
have--;
|
||||
hold += input[next++] << bits;
|
||||
hold >>>= 0;
|
||||
// Use '|' insdead of '+' to make sure that result is signed
|
||||
hold |= input[next++] << bits;
|
||||
bits += 8;
|
||||
}
|
||||
//===//
|
||||
|
@ -1371,7 +1371,8 @@ function inflate(strm, flush) {
|
|||
|
||||
}
|
||||
_out = left;
|
||||
if ((state.flags ? hold : ZSWAP32(hold) >>> 0) !== state.check >>> 0) {
|
||||
// NB: crc32 stored as signed 32-bit int, ZSWAP32 returns signed too
|
||||
if ((state.flags ? hold : ZSWAP32(hold)) !== state.check) {
|
||||
strm.msg = 'incorrect data check';
|
||||
state.mode = BAD;
|
||||
break;
|
||||
|
|
Ładowanie…
Reference in New Issue