1 | #[test ] |
2 | fn test_all_artifacts() { |
3 | extern crate std; |
4 | use crate::frame_decoder; |
5 | use std::borrow::ToOwned; |
6 | use std::fs; |
7 | use std::fs::File; |
8 | |
9 | let mut frame_dec = frame_decoder::FrameDecoder::new(); |
10 | |
11 | for file in fs::read_dir("./fuzz/artifacts/decode" ).unwrap() { |
12 | let file_name = file.unwrap().path(); |
13 | |
14 | let fnstr = file_name.to_str().unwrap().to_owned(); |
15 | if !fnstr.contains("/crash-" ) { |
16 | continue; |
17 | } |
18 | |
19 | let mut f = File::open(file_name.clone()).unwrap(); |
20 | |
21 | /* ignore errors. It just should never panic on invalid input */ |
22 | let _: Result<_, _> = frame_dec.reset(&mut f).and_then(|()| { |
23 | frame_dec.decode_blocks(&mut f, frame_decoder::BlockDecodingStrategy::All) |
24 | }); |
25 | } |
26 | } |
27 | |