Skip to content

Commit 443b0b8

Browse files
committed
Ensure backward compatibility
1 parent 13a1fee commit 443b0b8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/io/CompressedInputStream.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,14 @@ void CompressedInputStream::readHeader()
351351
const int crcSize = bsVersion <= 5 ? 16 : 24;
352352
const uint32 cksum1 = uint32(_ibs->readBits(crcSize));
353353

354-
uint32 seed = (bsVersion <= 5 ? 1 : 0x01030507) * uint32(bsVersion);
354+
uint32 seed = (bsVersion >= 6 ? 0x01030507 : 1) * uint32(bsVersion);
355355
const uint32 HASH = 0x1E35A7BD;
356356

357357
uint32 cksum2 = HASH * seed;
358-
cksum2 ^= (HASH * uint32(~ckSize));
358+
359+
if (bsVersion >= 6)
360+
cksum2 ^= (HASH * uint32(~ckSize));
361+
359362
cksum2 ^= (HASH * uint32(~_entropyType));
360363
cksum2 ^= (HASH * uint32((~_transformType) >> 32));
361364
cksum2 ^= (HASH * uint32(~_transformType));

0 commit comments

Comments
 (0)