rust-fuzz / libfuzzer

Rust bindings and utilities for LLVM’s libFuzzer
Apache License 2.0
206 stars 44 forks source link

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

Open wcampbell0x2a opened 3 years ago

wcampbell0x2a commented 3 years ago

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

frewsxcv commented 3 years ago

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

frewsxcv commented 3 years ago

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

raldone01 commented 1 year ago
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;
})