Skip to content

Commit

Permalink
When we dont check for request size we need to take care that the lef…
Browse files Browse the repository at this point in the history
…t shift does not panic
  • Loading branch information
KillingSpark committed Apr 1, 2024
1 parent 41d5a0d commit d748e36
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ extern crate ruzstd;
use ruzstd::frame_decoder;

fuzz_target!(|data: &[u8]| {
let mut content = data.clone();
let mut content = data;
let mut frame_dec = frame_decoder::FrameDecoder::new();

match frame_dec.reset(&mut content){
Expand Down
2 changes: 1 addition & 1 deletion src/decoding/bit_reader_reverse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl<'s> BitReaderReversed<'s> {
let emulated_read_shift = signed_n - self.bits_remaining();
let v = self.get_bits(self.bits_remaining() as u8);
debug_assert!(self.idx == 0);
let value = v << emulated_read_shift;
let value = v.wrapping_shl(emulated_read_shift as u32);
self.idx -= emulated_read_shift;
return value;
}
Expand Down

0 comments on commit d748e36

Please sign in to comment.