mirror of
https://github.com/chenxiaolong/avbroot.git
synced 2026-07-03 14:05:11 +02:00
c974ab5ec3
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
31 lines
838 B
Rust
31 lines
838 B
Rust
// SPDX-FileCopyrightText: 2024 Andrew Gunnerson
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#[cfg(not(windows))]
|
|
mod fuzz {
|
|
use std::io::{self, Cursor};
|
|
|
|
use avbroot::format::sparse::{ChunkData, CrcMode, SparseReader};
|
|
use honggfuzz::fuzz;
|
|
|
|
pub fn main() {
|
|
loop {
|
|
fuzz!(|data: &[u8]| {
|
|
let reader = Cursor::new(data);
|
|
if let Ok(mut sparse_reader) = SparseReader::new(reader, CrcMode::Ignore) {
|
|
while let Ok(Some(chunk)) = sparse_reader.next_chunk() {
|
|
if chunk.data == ChunkData::Data {
|
|
let _ = io::copy(&mut sparse_reader, &mut io::sink());
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
#[cfg(not(windows))]
|
|
fuzz::main();
|
|
}
|