google / fuzztest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rejecting unwanted inputs

KanishAnand opened this issue · comments

We are fuzzing a C++ API where there is undefined behaviour for certain out-of-bounds/invalid inputs

  • We do have precondition checks for all API's, so we could just bail out early and ignore the input, but we are worried about polluting the corpus with these invalid inputs which will be then selected for further mutation, creating outcomes 99% of which will probably still be invalid. So this an efficiency concern.
  • We can't detect these bad inputs with domain checks, because we are essentially doing https://github.com/google/fuzzing/blob/master/docs/structure-aware-fuzzing.md#fuzzing-stateful-apis where we execute a series of methods/calls against our API, and we don't know if an input is bad until we have got some way through the run, so we can't do it up-front.

Would you consider providing the ability for rejecting inputs similar to https://llvm.org/docs/LibFuzzer.html#rejecting-unwanted-inputs ? Or is this in some way the wrong philosophy these days?

Added fuzztest::SkipTestsOrCurrentInput() for this - feel free to reopen for any issues.