File tree Expand file tree Collapse file tree 3 files changed +14
-13
lines changed Expand file tree Collapse file tree 3 files changed +14
-13
lines changed Original file line number Diff line number Diff line change 1
1
2
2
target
3
- libfuzzer
3
+ corpus
4
+ artifacts
Original file line number Diff line number Diff line change 3
3
name = " url-fuzz"
4
4
version = " 0.0.1"
5
5
authors = [" Automatically generated" ]
6
+ publish = false
7
+
8
+ [package .metadata ]
9
+ cargo-fuzz = true
6
10
7
11
[dependencies .url ]
8
12
path = " .."
13
+ [dependencies .libfuzzer-sys ]
14
+ git = " https://github.com/rust-fuzz/libfuzzer-sys.git"
9
15
10
16
[[bin ]]
11
17
name = " parse"
Original file line number Diff line number Diff line change 1
1
#![ no_main]
2
-
3
- extern crate libfuzzer_sys;
4
-
2
+ #[ macro_use] extern crate libfuzzer_sys;
5
3
extern crate url;
6
- use std:: slice;
7
4
use std:: str;
8
5
9
- #[ export_name="LLVMFuzzerTestOneInput" ]
10
- pub extern fn go ( data : * const u8 , size : isize ) -> i32 {
11
- let slice = unsafe { slice:: from_raw_parts ( data, size as usize ) } ;
12
- if let Ok ( utf8) = str:: from_utf8 ( slice) {
13
- let url = url:: Url :: parse ( utf8) ;
14
- }
15
- return 0 ;
16
- }
6
+ fuzz_target ! ( |data: & [ u8 ] | {
7
+ if let Ok ( utf8) = str :: from_utf8( data) {
8
+ let _ = url:: Url :: parse( utf8) ;
9
+ }
10
+ } ) ;
You can’t perform that action at this time.
0 commit comments