Skip to content

Commit e3d09e7

Browse files
committed
Macro to expand from Rust function to libfuzzer compatible function. Issue #4
1 parent 85e0402 commit e3d09e7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,13 @@ pub fn test_input_wrap(data: *const u8, size: usize) -> i32 {
1414
}).err().map(|_| ::std::process::abort());
1515
0
1616
}
17+
18+
#[macro_export]
19+
macro_rules! fuzzer_target {
20+
(|$bytes:ident| $body:block) => {
21+
#[no_mangle]
22+
pub extern fn rust_fuzzer_test_input($bytes: &[u8]) {
23+
$body
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)