rust-fuzz / afl.rs

🐇 Fuzzing Rust code with American Fuzzy Lop
https://rust-fuzz.github.io/book/afl.html
Apache License 2.0
1.63k stars 105 forks source link

Use `expr` metavariable in `fuzz!` macro #490

Closed madsmtm closed 4 months ago

madsmtm commented 4 months ago

This allows expressions not wrapped in curly brackets, which is useful when e.g. calling out to another function:

fn fuzz_with(data: &[u8]) {
    // Do fuzzing
}

fn main() {
    fuzz!(|data| fuzz_with(data));
}

// before
fn main() {
    fuzz!(|data| { // Curly bracket required.
        fuzz_with(data);
    });
}
smoelius commented 4 months ago

Thanks!