Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to provide corpus seeds #285

Open
rillian opened this issue Jan 6, 2022 · 1 comment
Open

Document how to provide corpus seeds #285

rillian opened this issue Jan 6, 2022 · 1 comment

Comments

@rillian
Copy link

rillian commented Jan 6, 2022

I'm new to libfuzzer, so perhaps there's a simple way to do this, but I've not found a good way to pass a directory of seed files to the fuzzer.

Many projects have a collection of files for use in integration testing, and these can be a good starting point for fuzzing. Of course one can copy them into the corpus directory for the appropriate target, but one has to think of doing that.

Google's tutorial suggests passing additional directories on the fuzzer command line to seed the corpus. However, if I try something like:

cargo +nightly fuzz run <fuzz target name> -- ../test_files

The additional test_files path is placed before the default corpus created by cargo fuzz add. The fuzzer writes test cases to the first directory passed on the command line, so test_files ends up cluttered with fuzz inputs, complicating normal integration testing.

What I'd really like is some way to designate seed directories in fuzz/Cargo.toml so their specification could be checked into version control and included automatically in a naive cargo fuzz run so it's easier to get started and new test files are automatically added to the corpus when re-run.

Related to #194.

@smmalis37
Copy link

smmalis37 commented Jan 31, 2024

It would also be helpful if there was a way to provide a structured input. Like if I'm generating a struct with Arbitrary but I know what specific values I want all the fields to be, how do I make an input file that will cause that result?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants