googleprojectzero / Jackalope

Binary, coverage-guided fuzzer for Windows, macOS, Linux and Android
Apache License 2.0
1.1k stars 128 forks source link

Input files for grammar mode #26

Open heinreich1 opened 2 years ago

heinreich1 commented 2 years ago

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 commented 2 years ago

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

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.