libfuzzer icon indicating copy to clipboard operation
libfuzzer copied to clipboard

Add multiple variables implementing the `Arbitrary` type to `fuzz_target!`

Open wcampbell0x2a opened this issue 4 years ago • 4 comments

A possible upgrade would be the ability for creating multiple variables that are to be fuzzed from the same data in the fuzz_target macro.

Something like this?

fuzz_target!(|rgb: Rgb, other: Other| {})

That, or have another macro named fuzz_targets

wcampbell0x2a avatar May 06 '21 01:05 wcampbell0x2a

As a short term fix you can wrap both variables in a tuple

frewsxcv avatar May 06 '21 02:05 frewsxcv

Relevant: https://github.com/rust-fuzz/cargo-fuzz/issues/252

frewsxcv avatar May 06 '21 02:05 frewsxcv

fuzz_target!(|(rgb, other): (Rgb, Other)| {})

Unexpectely the above syntax also doesn't work.

I used this to work around the issue:

fuzz_target!(|data: (Rgb, Other)| {
let (rbg, other) = data;
})

raldone01 avatar Jul 23 '22 14:07 raldone01