mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-24 21:05:23 +00:00
[lib/Fuzzer] on crash print the contents of the crashy input as base64
llvm-svn: 236548
This commit is contained in:
parent
b7125c62c7
commit
177467fad4
@ -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