File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -273,10 +273,11 @@ void CompressedInputStream::readHeader()
273273 }
274274
275275 _ctx.putInt (" bsVersion" , bsVersion);
276+ uint64 ckSize = 0 ;
276277
277278 // Read block checksum
278279 if (bsVersion >= 6 ) {
279- uint64 ckSize = _ibs->readBits (2 );
280+ ckSize = _ibs->readBits (2 );
280281
281282 if (ckSize == 1 ) {
282283 _hasher32 = new XXHash32 (BITSTREAM_TYPE);
@@ -352,7 +353,9 @@ void CompressedInputStream::readHeader()
352353
353354 uint32 seed = (bsVersion <= 5 ? 1 : 0x01030507 ) * uint32 (bsVersion);
354355 const uint32 HASH = 0x1E35A7BD ;
356+
355357 uint32 cksum2 = HASH * seed;
358+ cksum2 ^= (HASH * uint32 (~ckSize));
356359 cksum2 ^= (HASH * uint32 (~_entropyType));
357360 cksum2 ^= (HASH * uint32 ((~_transformType) >> 32 ));
358361 cksum2 ^= (HASH * uint32 (~_transformType));
Original file line number Diff line number Diff line change @@ -296,6 +296,7 @@ void CompressedOutputStream::writeHeader()
296296 uint32 seed = 0x01030507 * BITSTREAM_FORMAT_VERSION; // no const to avoid VS2008 warning
297297 const uint32 HASH = 0x1E35A7BD ;
298298 uint32 cksum = HASH * seed;
299+ cksum ^= (HASH * uint32 (~ckSize));
299300 cksum ^= (HASH * uint32 (~_entropyType));
300301 cksum ^= (HASH * uint32 ((~_transformType) >> 32 ));
301302 cksum ^= (HASH * uint32 (~_transformType));
You can’t perform that action at this time.
0 commit comments