forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

inflate_diff.rs28 lines, 863 bytesHistoryRawDownload
1#![no_main]
2
3use ec_inflate::{inflate, inflate_zlib};
4use libfuzzer_sys::fuzz_target;
5
6const LIMIT: usize = 16 << 20;
7
8// Differential: byte 0 bit 0 picks raw or zlib. Whenever both decoders succeed,
9// the bytes must match. Either side may reject input the other accepts; that is not a finding here.
10fuzz_target!(|data: &[u8]| {
11 let Some((&sel, body)) = data.split_first() else {
12 return;
13 };
14 let (ours, theirs) = if sel & 1 == 0 {
15 (
16 inflate(body, LIMIT),
17 miniz_oxide::inflate::decompress_to_vec_with_limit(body, LIMIT),
18 )
19 } else {
20 (
21 inflate_zlib(body, LIMIT),
22 miniz_oxide::inflate::decompress_to_vec_zlib_with_limit(body, LIMIT),
23 )
24 };
25 if let (Ok(a), Ok(b)) = (ours, theirs) {
26 assert_eq!(a, b, "ec-inflate and miniz_oxide disagree");
27 }
28});