Skip to content

Commit

Permalink
Change fuzzing harness to be representative of real-world code. It ca…
Browse files Browse the repository at this point in the history
…n now find KillingSpark#75
  • Loading branch information
Shnatsel committed Nov 28, 2024
1 parent 78c4172 commit 1695035
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions fuzz/fuzz_targets/decode.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
#![no_main]
#[macro_use] extern crate libfuzzer_sys;
extern crate ruzstd;
use ruzstd::frame_decoder;
use std::io::Read;

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

match frame_dec.reset(&mut content){
Ok(_) => {
let _ = frame_dec.decode_blocks(&mut content,frame_decoder::BlockDecodingStrategy::All);
}
Err(_) => {/* nothing */}
if let Ok(mut decoder) = ruzstd::StreamingDecoder::new(data) {
let mut output = Vec::new();
_ = decoder.read_to_end(&mut output);
}
});

0 comments on commit 1695035

Please sign in to comment.