Coverage Report

Created: 2024-08-22 06:13

/src/gitoxide/gix-commitgraph/fuzz/fuzz_targets/fuzz_file.rs
Line
Count
Source (jump to first uncovered line)
1
#![no_main]
2
3
use anyhow::Result;
4
use gix_commitgraph::File;
5
use libfuzzer_sys::fuzz_target;
6
use std::hint::black_box;
7
8
488
fn fuzz(data: &[u8]) -> Result<()> {
9
488
    let data = {
10
488
        let mut d = memmap2::MmapMut::map_anon(data.len())?;
11
488
        d.copy_from_slice(data);
12
488
        d.make_read_only()?
13
    };
14
488
    let file = File::new(data, "does not matter".into())?;
15
16
0
    _ = black_box(file.iter_base_graph_ids().count());
17
0
    _ = black_box(file.iter_commits().count());
18
0
    _ = black_box(file.iter_ids().count());
19
0
20
0
    let _ = black_box(file.checksum());
21
0
    let _ = black_box(file.verify_checksum());
22
0
    let _ = black_box(file.object_hash());
23
0
24
0
    Ok(())
25
488
}
26
27
fuzz_target!(|data: &[u8]| {
28
    _ = black_box(fuzz(data));
29
});