mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-25 03:30:37 +00:00
[lib/Fuzzer] on crash print the contents of the crashy input as base64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236548 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cc0615ad0a
commit
605f316258
@ -60,4 +60,9 @@ std::string DirPlusFile(const std::string &DirPath,
|
||||
return DirPath + "/" + FileName;
|
||||
}
|
||||
|
||||
void PrintFileAsBase64(const std::string &Path) {
|
||||
std::string Cmd = "base64 -w 0 < " + Path + "; echo";
|
||||
system(Cmd.c_str());
|
||||
}
|
||||
|
||||
} // namespace fuzzer
|
||||
|
@ -40,6 +40,7 @@ void Print(const Unit &U, const char *PrintAfter = "");
|
||||
void PrintASCII(const Unit &U, const char *PrintAfter = "");
|
||||
std::string Hash(const Unit &U);
|
||||
void SetTimer(int Seconds);
|
||||
void PrintFileAsBase64(const std::string &Path);
|
||||
|
||||
class Fuzzer {
|
||||
public:
|
||||
|
@ -246,6 +246,8 @@ void Fuzzer::WriteToCrash(const Unit &U, const char *Prefix) {
|
||||
std::string Path = Prefix + Hash(U);
|
||||
WriteToFile(U, Path);
|
||||
std::cerr << "CRASHED; file written to " << Path << std::endl;
|
||||
std::cerr << "Base64: ";
|
||||
PrintFileAsBase64(Path);
|
||||
}
|
||||
|
||||
void Fuzzer::SaveCorpus() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user