Problem
DeltaByteArrayDecoder::get assumes decoded prefix lengths are always valid and directly slices:
self.previous_value[0..prefix_len]
If the decoded prefix_len is negative (after decoding) or larger than
previous_value.len(), this results in a slice bounds panic.
Expected Behavior
The decoder should return Err on invalid input instead of panicking.
Actual Behavior
Invalid prefix lengths can cause a panic such as:
range end index X out of range for slice of length Y
Reproduction
This can be reproduced by:
- encoding valid DELTA_BYTE_ARRAY data
- modifying the prefix-length stream (DELTA_BINARY_PACKED)
- decoding using
DeltaByteArrayDecoder::get
This leads to a panic instead of returning an error.
Notes
- There is currently no validation for:
- negative prefix lengths
- prefix lengths exceeding
previous_value.len()
- Other decoders (e.g., DELTA_BINARY_PACKED) perform validation on decoded values,
but this check is missing here.
Impact
This can cause unexpected panics when reading invalid or unexpected encoded data,
instead of returning a controlled error.
Problem
DeltaByteArrayDecoder::getassumes decoded prefix lengths are always valid and directly slices:If the decoded
prefix_lenis negative (after decoding) or larger thanprevious_value.len(), this results in a slice bounds panic.Expected Behavior
The decoder should return
Erron invalid input instead of panicking.Actual Behavior
Invalid prefix lengths can cause a panic such as:
Reproduction
This can be reproduced by:
DeltaByteArrayDecoder::getThis leads to a panic instead of returning an error.
Notes
previous_value.len()but this check is missing here.
Impact
This can cause unexpected panics when reading invalid or unexpected encoded data,
instead of returning a controlled error.