Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Released YYYY-MM-DD.

* Bindings to `LLVMFuzzerCustomCrossOver` through the `fuzz_crossover` macro.
* `example_crossover` using both `fuzz_mutator` and `fuzz_crossover` (adapted from @rigtorp)
* Support for `mut` in the `fuzz_target!` macro.

### Changed

Expand Down
10 changes: 9 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ pub fn initialize(_argc: *const isize, _argv: *const *const *const u8) -> isize
/// `"arbitrary-derive"` cargo feature.
#[macro_export]
macro_rules! fuzz_target {
(|$bytes:ident| $body:expr) => {
(|$bytes:pat_param| $body:expr) => {
const _: () = {
/// Auto-generated function
#[no_mangle]
Expand Down Expand Up @@ -249,10 +249,18 @@ macro_rules! fuzz_target {
$crate::fuzz_target!(|$data| $body);
};

(|mut $data:ident: &[u8]| $body:expr) => {
$crate::fuzz_target!(|mut $data| $body);
};

(|$data:ident: $dty:ty| $body:expr) => {
$crate::fuzz_target!(|$data: $dty| -> () { $body });
};

(|mut $data:ident: $dty:ty| $body:expr) => {
$crate::fuzz_target!(|mut $data: $dty| -> () { $body });
};

(|$data:ident: $dty:ty| -> $rty:ty $body:block) => {
const _: () = {
/// Auto-generated function
Expand Down