mirror of
https://github.com/facebook/zstd.git
synced 2025-11-29 00:04:37 -05:00
Fix invalid assert in 32-bit decoding
The assert is only correct for valid sequences, so disable it for everything execpt round trip fuzzers.
This commit is contained in:
parent
423a74986f
commit
b3b43f2893
@ -1241,7 +1241,13 @@ ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets)
|
||||
offset = ofBase + (BIT_readBitsFast(&seqState->DStream, ofBits - extraBits) << extraBits);
|
||||
BIT_reloadDStream(&seqState->DStream);
|
||||
if (extraBits) offset += BIT_readBitsFast(&seqState->DStream, extraBits);
|
||||
#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
|
||||
/* This assert is only valid when decoding valid sequences.
|
||||
* It cal fail when we consume more bits than are in the bitstream,
|
||||
* which can happen on corruption.
|
||||
*/
|
||||
assert(extraBits <= LONG_OFFSETS_MAX_EXTRA_BITS_32); /* to avoid another reload */
|
||||
#endif
|
||||
} else {
|
||||
offset = ofBase + BIT_readBitsFast(&seqState->DStream, ofBits/*>0*/); /* <= (ZSTD_WINDOWLOG_MAX-1) bits */
|
||||
if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user