[libFuzzer] warn if the corpus is empty

llvm-svn: 266670
This commit is contained in:
Kostya Serebryany 2016-04-18 21:14:11 +00:00
parent 9c7ea2dfaa
commit 09087bba4d
2 changed files with 5 additions and 1 deletions

View File

@ -376,8 +376,11 @@ static int FuzzerDriver(const std::vector<std::string> &Args,
F.SetMaxLen(
std::min(std::max(kMinDefaultLen, F.MaxUnitSizeInCorpus()), kMaxSaneLen));
if (F.CorpusSize() == 0)
if (F.CorpusSize() == 0) {
F.AddToCorpus(Unit()); // Can't fuzz empty corpus, so add an empty input.
if (Options.Verbosity)
Printf("INFO: A corpus is not provided, starting from an empty corpus\n");
}
F.ShuffleAndMinimize();
if (Flags.drill)
F.Drill();

View File

@ -118,3 +118,4 @@ FD_MASK_3: INITED
RUN: LLVMFuzzer-SimpleTest -runs=10 --max_len=100 2>&1 | FileCheck %s --check-prefix=DASH_DASH
DASH_DASH: WARNING: did you mean '-max_len=100' (single dash)?
DASH_DASH: INFO: A corpus is not provided, starting from an empty corpus