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

Method WriteUnitToFileWithPrefix

fuzz/libfuzzer/FuzzerLoop.cpp:660–677  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

658}
659
660void Fuzzer::WriteUnitToFileWithPrefix(const Unit &U, const char *Prefix) {
661 if (!Options.SaveArtifacts)
662 return;
663 std::time_t current_time = std::time(nullptr);
664 // Convert the timestamp to a string
665 std::string timestamp_str = std::to_string(current_time);
666 std::stringstream ss;
667 ss << std::setw(10) << std::setfill('0') << TotalNumberOfRuns;
668 std::string Iterations = ss.str();
669 std::string Path = Options.ArtifactPrefix + Prefix + Iterations + '-' + Hash(U) + '-' + timestamp_str;
670 if (!Options.ExactArtifactPath.empty())
671 Path = Options.ExactArtifactPath; // Overrides ArtifactPrefix.
672 WriteToFile(U, Path);
673 Printf("artifact_prefix='%s'; Test unit written to %s\n",
674 Options.ArtifactPrefix.c_str(), Path.c_str());
675 if (U.size() <= kMaxUnitSizeToPrint)
676 Printf("Base64: %s\n", Base64(U).c_str());
677}
678
679void Fuzzer::PrintStatusForNewUnit(const Unit &U, const char *Text) {
680 if (!Options.PrintNEW)

Callers

nothing calls this directly

Calls 8

WriteToFileFunction · 0.85
Base64Function · 0.85
HashFunction · 0.70
PrintfFunction · 0.70
strMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected