File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ cargo-fuzz = true
11
11
anyhow = " 1.0.76"
12
12
arbitrary = { version = " 1.3.2" , features = [" derive" ] }
13
13
libfuzzer-sys = " 0.4"
14
- tempfile = " 3.8.1 "
14
+ memmap2 = " 0.9.0 "
15
15
16
16
[dependencies .gix-commitgraph ]
17
17
path = " .."
Original file line number Diff line number Diff line change 1
1
#![ no_main]
2
2
3
3
use anyhow:: Result ;
4
- use arbitrary:: Arbitrary ;
5
4
use gix_commitgraph:: File ;
6
5
use libfuzzer_sys:: fuzz_target;
7
- use std:: fs;
8
6
use std:: hint:: black_box;
9
- use tempfile:: NamedTempFile ;
10
7
11
8
fn fuzz ( data : & [ u8 ] ) -> Result < ( ) > {
12
- let named_temp_file = NamedTempFile :: new ( ) ?;
13
- fs:: write ( named_temp_file. path ( ) , data) . expect ( "Unable to write fuzzed file" ) ;
14
- let file = File :: try_from ( named_temp_file. path ( ) ) ?;
9
+ let data = {
10
+ let mut d = memmap2:: MmapMut :: map_anon ( data. len ( ) ) ?;
11
+ d. copy_from_slice ( data) ;
12
+ d. make_read_only ( ) ?
13
+ } ;
14
+ let file = File :: new ( data, "does not matter" . into ( ) ) ?;
15
15
16
16
_ = black_box ( file. iter_base_graph_ids ( ) . count ( ) ) ;
17
17
_ = black_box ( file. iter_commits ( ) . count ( ) ) ;
You can’t perform that action at this time.
0 commit comments