forked from KillingSpark/zstd-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change fuzzing harness to be representative of real-world code. It ca…
…n now find KillingSpark#75
- Loading branch information
Showing
1 changed file
with
4 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
}); |