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

Input files for grammar mode #26

Open
heinreich1 opened this issue Jan 27, 2022 · 1 comment
Open

Input files for grammar mode #26

heinreich1 opened this issue Jan 27, 2022 · 1 comment

Comments

@heinreich1
Copy link

Hi,

Is there any documentation regarding preparing input files when fuzzing in grammar mode?
I'm trying to play with the sample grammar but I get errors like those:
Incorrectly encoded grammar sample Location : GrammarFuzzer::OutputFilter()

Am I missing something? Thanks :)

@ifratric
Copy link
Collaborator

ifratric commented Jan 28, 2022

Hi! At this time, there is no (easy) way to prepare input files manually. Instead, it is expected to start with an empty input corpus and let the grammar itself generate the initial set of samples. If you ran a session with a grammar before, and you want to run a session later using the same grammar, then you can re-use the samples generated earlier (located in out_directory/samples) as the input samples.

If you want the grammar to generate specific type of samples for the initial corpus (as opposed to just letting it run with the full grammar) you can

  • comment out rules you don't want
  • the fuzzer run and generate the samples according to the remaining rules
  • stop the fuzzer
  • uncomment the rest of the rules
  • resume the fuzzing session or start a new one using generated samples as input

Some context behind such design: parsing samples into their grammar representation is much harder than generating them and in fact there is no guaranteed unique way to parse a sample given a context-free grammar.

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