afl.rs icon indicating copy to clipboard operation
afl.rs copied to clipboard

Rethink API

Open frewsxcv opened this issue 9 years ago • 3 comments

Would be nice to make this library simpler to use. I've been thinking an API like this:

use afl;

fn main() {
    // Some setup can happen here

    // Loop that AFL will run
    afl::run(|inputted_string| {
        let _ = some_library::parse_string(inputted_string);
    });
}

inputted_string would be a String. the closure inside afl::run is the only thing that gets run upon every subsequent call by AFL using the deferred init strategy

frewsxcv avatar Jan 26 '16 04:01 frewsxcv

Another idea here. Something like cargo bench:

#[fuzz]
fn test_fuzz(bytes: Vec<u8>) {
    ...
}

which can be invoked with something like cargo afl-fuzz

frewsxcv avatar Apr 23 '16 15:04 frewsxcv

Nice! even simpler, I love it.

On Sat, Apr 23, 2016 at 11:44 AM, Corey Farwell [email protected] wrote:

Another idea here. Something like cargo bench:

#[fuzz]fn test_fuzz(bytes: Vec) { ... }

which can be invoked with something like cargo afl-fuzz

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/frewsxcv/afl.rs/issues/31#issuecomment-213767532

"I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero GPG Key fingerprint: D1B3 ADC0 E023 8CA6

alex avatar Apr 23 '16 15:04 alex

Note to future self:

rust-quickcheck implements a #[quickcheck] compiler plugin very similar to what I was thinking above.

example of usage

compiler plugin source

frewsxcv avatar May 02 '16 12:05 frewsxcv