Lines Matching +full:all +full:- +full:inputs +full:- +full:2
1 //===- FuzzerDriver.cpp - FuzzerDriver function and flags -----------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 //===----------------------------------------------------------------------===//
89 static std::vector<std::string> *Inputs;
94 auto Prog = ProgName->c_str();
96 Printf("%s [-flag1=val1 [-flag2=val2 ...] ] [dir1 [dir2 ...] ]\n", Prog);
99 Printf("%s [-flag1=val1 [-flag2=val2 ...] ] file1 [file2 ...]\n", Prog);
101 Printf("\nFlags: (strictly in form -flag=value)\n");
110 for (size_t i = 0, n = MaxFlagLen - strlen(D.Name); i < n; i++)
115 Printf("\nFlags starting with '--' will be ignored and "
121 if (Param[0] == '-' && strstr(Param + 1, Name) == Param + 1 &&
123 return &Param[Len + 2];
131 if (*Str == '-') {
133 Sign = -1;
139 Res = Res * 10 + (Ch - '0');
145 if (Param[0] != '-') return false;
146 if (Param[1] == '-') {
150 Printf("INFO: libFuzzer ignores flags that start with '--'\n");
164 if (Flags.verbosity >= 2)
170 if (Flags.verbosity >= 2)
175 if (Flags.verbosity >= 2)
185 "use -help=1 to list all flags\n\n", Param);
203 if (EF->LLVMFuzzerCustomMutator) {
206 "Disabling -len_control by default.\n", EF->LLVMFuzzerCustomMutator);
209 Inputs = new std::vector<std::string>;
216 Inputs->push_back(Args[A]);
236 std::string Log = "fuzz-" + std::to_string(C) + ".log";
313 F->RssLimitCallback();
328 F->ExecuteCallback(U.data(), U.size());
331 F->TPCUpdateObservedPCs();
333 F->TryDetectingAMemoryLeak(U.data(), U.size(), true);
339 if (Inputs->empty()) return false;
340 for (auto &Path : *Inputs)
353 return S.substr(Beg, End - Beg);
358 if (Inputs->size() != 1 || !Flags.exact_artifact_path) {
359 Printf("ERROR: -cleanse_crash should be given one input file and"
360 " -exact_artifact_path\n");
363 std::string InputFilePath = Inputs->at(0);
413 if (Inputs->size() != 1) {
414 Printf("ERROR: -minimize_crash should be given one input file\n");
417 std::string InputFilePath = Inputs->at(0);
424 Printf("INFO: you need to specify -runs=N or "
425 "-max_total_time=N with -minimize_crash=1\n"
426 "INFO: defaulting to -max_total_time=600\n");
458 : Options.ArtifactPrefix + "minimized-from-" + Hash(U);
495 assert(Inputs->size() == 1);
496 std::string InputFilePath = Inputs->at(0);
499 if (U.size() < 2) {
503 F->SetMaxInputLen(U.size());
504 F->SetMaxMutationLen(U.size() - 1);
505 F->MinimizeCrashLoop(U);
513 if (Corpora.size() < 2) {
531 F->WriteToOutputCorpus(FileToVector(Path, Options.MaxLen));
542 Dict.size() * Corpus.size() * 2);
552 F->ExecuteCallback(C.data(), C.size());
568 // Replace all occurrences of dictionary unit in the testcase.
578 F->ExecuteCallback(Data.data(), Data.size());
585 --Scores[i];
587 Scores[i] += 2;
606 // Parse -seed_inputs=file1,file2,... or -seed_inputs=@seed_inputs_file
635 Printf("INFO: % 8zd files found in %s\n", SizedFiles.size() - LastNumFiles,
650 if (EF->LLVMFuzzerInitialize)
651 EF->LLVMFuzzerInitialize(argc, argv);
652 if (EF->__msan_scoped_disable_interceptor_checks)
653 EF->__msan_scoped_disable_interceptor_checks();
667 if (Flags.close_fd_mask & 2)
673 Flags.workers = std::min(NumberOfCpuCores() / 2, Flags.jobs);
716 if (!Inputs->empty() && !Flags.minimize_crash_internal_step) {
719 std::string OutputCorpusDir = (*Inputs)[0];
733 if (!IsSeparator(ArtifactPathDir[ArtifactPathDir.length() - 1])) {
807 ReadCorpora({}, *Inputs));
810 ReadCorpora(*Inputs, {}));
820 MD->AddWordToManualDictionary(Word(U.data(), U.size()));
857 Printf("%s: Running %zd inputs %d time(s) each.\n", ProgName->c_str(),
858 Inputs->size(), Runs);
859 for (auto &Path : *Inputs) {
865 auto MS = duration_cast<milliseconds>(StopTime - StartTime).count();
870 "*** executed the target code on a fixed set of inputs.\n"
872 F->PrintFinalStats();
878 FuzzWithFork(F->GetMD().GetRand(), Options, Args, *Inputs, Flags.fork);
881 Merge(F, Options, Args, *Inputs, Flags.merge_control_file);
886 F->SetMaxInputLen(kDefaultMaxMergeLen);
888 F->CrashResistantMergeInternalStep(Flags.merge_control_file,
889 !strncmp(Flags.merge_inner, "2", 1));
896 for (auto &Inp : *Inputs) {
902 if (Dictionary.empty() || Inputs->empty()) {
914 auto CorporaFiles = ReadCorpora(*Inputs, ParseSeedInuts(Flags.seed_inputs));
915 F->Loop(CorporaFiles);
918 Printf("Done %zd runs in %zd second(s)\n", F->getTotalNumberOfRuns(),
919 F->secondsSinceProcessStartUp());
920 F->PrintFinalStats();