-
Notifications
You must be signed in to change notification settings - Fork 4
/
inflate.rs
29 lines (27 loc) · 986 Bytes
/
inflate.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#![no_main]
use libfuzzer_sys::fuzz_target;
use miniz_oxide::inflate::TINFLStatus;
fuzz_target!(|input: &[u8]| {
if input.is_empty() {
return;
}
match fdeflate::decompress_to_vec(&input) {
Ok(decompressed) => {
if decompressed.is_empty() {
return;
}
let Ok(decompressed2) = miniz_oxide::inflate::decompress_to_vec_zlib(&input) else {return};
assert_eq!(decompressed, decompressed2);
}
Err(fdeflate::DecompressionError::BadLiteralLengthHuffmanTree) => {}
Err(fdeflate::DecompressionError::InvalidDistanceCode) => {}
Err(err) => match miniz_oxide::inflate::decompress_to_vec_zlib(&input) {
Err(r)
if r.status == TINFLStatus::Failed
|| r.status == TINFLStatus::FailedCannotMakeProgress => {}
r => {
panic!("fdeflate: {:?}, miniz_oxide: {:?}", err, r);
}
},
}
});