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

Method WriteToOutputCorpus

fuzz/libfuzzer/FuzzerLoop.cpp:641–658  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

639}
640
641std::string Fuzzer::WriteToOutputCorpus(const Unit &U) {
642 if (Options.OnlyASCII)
643 assert(IsASCII(U));
644 if (Options.OutputCorpus.empty())
645 return "";
646 std::time_t current_time = std::time(nullptr);
647 // Convert the timestamp to a string
648 std::string timestamp_str = std::to_string(current_time);
649 std::stringstream ss;
650 ss << std::setw(10) << std::setfill('0') << TotalNumberOfRuns;
651 std::string Prefix = ss.str();
652 std::string Filename = Prefix + '-' + Hash(U) + '-' + timestamp_str;
653 std::string Path = DirPlusFile(Options.OutputCorpus, Filename);
654 WriteToFile(U, Path);
655 if (Options.Verbosity >= 2)
656 Printf("Written %zd bytes to %s\n", U.size(), Path.c_str());
657 return Path;
658}
659
660void Fuzzer::WriteUnitToFileWithPrefix(const Unit &U, const char *Prefix) {
661 if (!Options.SaveArtifacts)

Callers 1

MergeFunction · 0.80

Calls 9

IsASCIIFunction · 0.85
DirPlusFileFunction · 0.85
WriteToFileFunction · 0.85
HashFunction · 0.70
PrintfFunction · 0.70
emptyMethod · 0.45
strMethod · 0.45
sizeMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected