Coverage Report

Created: 2025-07-23 07:16

/src/regex/fuzz/fuzz_targets/ast_fuzz_match.rs
Line
Count
Source (jump to first uncovered line)
1
#![no_main]
2
3
use {
4
    libfuzzer_sys::{fuzz_target, Corpus},
5
    regex::RegexBuilder,
6
    regex_syntax::ast::Ast,
7
};
8
9
51.3k
#[derive(Eq, PartialEq, arbitrary::Arbitrary)]
<ast_fuzz_match::FuzzData as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#1}
Line
Count
Source
9
25.6k
#[derive(Eq, PartialEq, arbitrary::Arbitrary)]
<ast_fuzz_match::FuzzData as arbitrary::Arbitrary>::try_size_hint::{closure#0}
Line
Count
Source
9
25.6k
#[derive(Eq, PartialEq, arbitrary::Arbitrary)]
Unexecuted instantiation: <ast_fuzz_match::FuzzData as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}
Unexecuted instantiation: <ast_fuzz_match::FuzzData as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#2}
Unexecuted instantiation: <ast_fuzz_match::FuzzData as arbitrary::Arbitrary>::arbitrary::{closure#0}
Unexecuted instantiation: <ast_fuzz_match::FuzzData as arbitrary::Arbitrary>::arbitrary::{closure#1}
Unexecuted instantiation: <ast_fuzz_match::FuzzData as arbitrary::Arbitrary>::arbitrary::{closure#2}
10
struct FuzzData {
11
    ast: Ast,
12
    haystack: String,
13
}
14
15
impl std::fmt::Debug for FuzzData {
16
0
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17
0
        let mut builder = f.debug_struct("FuzzData");
18
0
        builder.field("ast", &format!("{}", self.ast));
19
0
        builder.field("haystack", &self.haystack);
20
0
        builder.finish()
21
0
    }
22
}
23
24
fuzz_target!(|data: FuzzData| -> Corpus {
25
    let _ = env_logger::try_init();
26
27
    let pattern = format!("{}", data.ast);
28
    let Ok(re) = RegexBuilder::new(&pattern).size_limit(1 << 20).build()
29
    else {
30
        return Corpus::Reject;
31
    };
32
    let _ = re.is_match(&data.haystack);
33
    let _ = re.find(&data.haystack);
34
6.68k
    let _ = re.captures(&data.haystack).map_or(0, |c| c.len());
35
    Corpus::Keep
36
});