MCPcopy Create free account
hub / github.com/HexHive/NASS / Loop

Method Loop

fuzz/libfuzzer/FuzzerLoop.cpp:890–940  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

888}
889
890void Fuzzer::Loop(std::vector<SizedFile> &CorporaFiles) {
891 auto FocusFunctionOrAuto = Options.FocusFunction;
892 DFT.Init(Options.DataFlowTrace, &FocusFunctionOrAuto, CorporaFiles,
893 MD.GetRand());
894 TPC.SetFocusFunction(FocusFunctionOrAuto);
895 ReadAndExecuteSeedCorpora(CorporaFiles);
896 DFT.Clear(); // No need for DFT any more.
897 TPC.SetPrintNewPCs(Options.PrintNewCovPcs);
898 TPC.SetPrintNewFuncs(Options.PrintNewCovFuncs);
899 system_clock::time_point LastCorpusReload = system_clock::now();
900
901 TmpMaxMutationLen =
902 Min(MaxMutationLen, Max(size_t(4), Corpus.MaxInputSize()));
903
904 while (true) {
905 auto Now = system_clock::now();
906 if (!Options.StopFile.empty() &&
907 !FileToVector(Options.StopFile, 1, false).empty())
908 break;
909 if (duration_cast<seconds>(Now - LastCorpusReload).count() >=
910 Options.ReloadIntervalSec) {
911 RereadOutputCorpus(MaxInputLen);
912 LastCorpusReload = system_clock::now();
913 }
914 if (TotalNumberOfRuns >= Options.MaxNumberOfRuns)
915 break;
916 if (TimedOut())
917 break;
918
919 // Update TmpMaxMutationLen
920 if (Options.LenControl) {
921 if (TmpMaxMutationLen < MaxMutationLen &&
922 TotalNumberOfRuns - LastCorpusUpdateRun >
923 Options.LenControl * Log(TmpMaxMutationLen)) {
924 TmpMaxMutationLen =
925 Min(MaxMutationLen, TmpMaxMutationLen + Log(TmpMaxMutationLen));
926 LastCorpusUpdateRun = TotalNumberOfRuns;
927 }
928 } else {
929 TmpMaxMutationLen = MaxMutationLen;
930 }
931
932 // Perform several mutations and runs.
933 MutateAndTestOne();
934
935 PurgeAllocator();
936 }
937
938 PrintStats("DONE ", "\n");
939 MD.PrintRecommendedDictionary();
940}
941
942void Fuzzer::MinimizeCrashLoop(const Unit &U) {
943 if (U.size() <= 1)

Callers 1

FuzzerDriverFunction · 0.80

Calls 13

MinFunction · 0.85
MaxFunction · 0.85
FileToVectorFunction · 0.85
LogFunction · 0.85
InitMethod · 0.80
SetFocusFunctionMethod · 0.80
ClearMethod · 0.80
SetPrintNewPCsMethod · 0.80
SetPrintNewFuncsMethod · 0.80
MaxInputSizeMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected