File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+
2+ target
3+ corpus
4+ artifacts
Original file line number Diff line number Diff line change 1+
2+ [package ]
3+ name = " flate2-fuzz"
4+ version = " 0.0.0"
5+ authors = [" Automatically generated" ]
6+ publish = false
7+ edition = " 2018"
8+
9+ [package .metadata ]
10+ cargo-fuzz = true
11+
12+ [dependencies ]
13+ libfuzzer-sys = " 0.4"
14+ flate2 = { path = " .." }
15+
16+ # Prevent this from interfering with workspaces
17+ [workspace ]
18+ members = [" ." ]
19+
20+ [[bin ]]
21+ name = " fuzz_gz_roundtrip"
22+ path = " fuzz_targets/fuzz_gz_roundtrip.rs"
23+ test = false
24+ doc = false
Original file line number Diff line number Diff line change 1+ #![ no_main]
2+ use libfuzzer_sys:: fuzz_target;
3+ use flate2:: write:: GzEncoder ;
4+ use flate2:: Compression ;
5+ use flate2:: read:: GzDecoder ;
6+ use std:: io:: prelude:: * ;
7+
8+
9+ fuzz_target ! ( |data: & [ u8 ] | {
10+ let mut encoder = GzEncoder :: new( Vec :: new( ) , Compression :: default ( ) ) ;
11+ encoder. write_all( data) . unwrap( ) ;
12+ let result = encoder. finish( ) . unwrap( ) ;
13+ let mut r = GzDecoder :: new( & result[ ..] ) ;
14+ let mut ret = Vec :: new( ) ;
15+ r. read_to_end( & mut ret) . unwrap( ) ;
16+ assert!( ret == data) ;
17+ } ) ;
You can’t perform that action at this time.
0 commit comments