File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ edition = "2021"
10
10
cargo-fuzz = true
11
11
12
12
[dependencies ]
13
- libfuzzer-sys = " 0.3"
13
+ libfuzzer-sys = " 0.4.7"
14
+ arbitrary = { version = " 1" , features = [" derive" ] }
14
15
15
16
[dependencies .gix-config ]
16
17
path = " .."
Original file line number Diff line number Diff line change 1
1
#![ no_main]
2
2
3
+ use arbitrary:: Arbitrary ;
4
+ use gix_config:: { parse:: Events , File } ;
3
5
use libfuzzer_sys:: fuzz_target;
6
+ use std:: hint:: black_box;
4
7
5
- fuzz_target ! ( |data: & [ u8 ] | {
6
- // Don't name this _; Rust may optimize it out.
7
- let _a = gix_config:: parse:: from_bytes( data, & mut |_e| ( ) ) ;
8
+ #[ derive( Debug , Arbitrary , Clone ) ]
9
+ struct Ctx < ' a > {
10
+ parse_from_bytes : & ' a [ u8 ] ,
11
+ parse_file : & ' a str ,
12
+ parse_events : & ' a str ,
13
+ }
14
+
15
+ fuzz_target ! ( |ctx: Ctx | {
16
+ _ = black_box( gix_config:: parse:: from_bytes( ctx. parse_from_bytes, & mut |_e| ( ) ) ) ;
17
+ _ = black_box( File :: try_from( ctx. parse_file) ) ;
18
+ _ = black_box( Events :: try_from( ctx. parse_events) ) ;
8
19
} ) ;
You can’t perform that action at this time.
0 commit comments