File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -18,15 +18,17 @@ fuzzer-sys = { path = "../libfuzzer-sys" } # or something
18
18
19
19
$ cat src/main.rs
20
20
#![no_main]
21
+ #[macro_use]
21
22
extern crate fuzzer_sys;
22
23
23
- #[export_name="rust_fuzzer_test_input"]
24
- pub extern fn go(data: &[u8]) {
25
- // code to be fuzzed goes here
26
- }
24
+ fuzz_target!(|data| {
25
+ // code to fuzz goes here
26
+ });
27
27
28
28
$ cargo rustc -- -C passes='sancov' -C llvm-args='-sanitizer-coverage-level=3' -Z sanitizer=address -Cpanic=abort
29
29
$ ./target/debug/fuzzed # runs fuzzing
30
30
```
31
31
32
- Nice wrappers incoming soon
32
+ For a nice wrapper see [ cargo-fuzz] .
33
+
34
+ [ cargo-fuzz ] : https://github.com/rust-fuzz/cargo-fuzz
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ pub fn test_input_wrap(data: *const u8, size: usize) -> i32 {
16
16
}
17
17
18
18
#[ macro_export]
19
- macro_rules! fuzzer_target {
19
+ macro_rules! fuzz_target {
20
20
( |$bytes: ident| $body: block) => {
21
21
#[ no_mangle]
22
22
pub extern fn rust_fuzzer_test_input( $bytes: & [ u8 ] ) {
You can’t perform that action at this time.
0 commit comments