[llvm] r236548 - [lib/Fuzzer] on crash print the contents of the crashy input as base64
Kostya Serebryany
kcc at google.com
Tue May 5 14:59:51 PDT 2015
Author: kcc
Date: Tue May 5 16:59:51 2015
New Revision: 236548
URL: http://llvm.org/viewvc/llvm-project?rev=236548&view=rev
Log:
[lib/Fuzzer] on crash print the contents of the crashy input as base64
Modified:
llvm/trunk/lib/Fuzzer/FuzzerIO.cpp
llvm/trunk/lib/Fuzzer/FuzzerInternal.h
llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
Modified: llvm/trunk/lib/Fuzzer/FuzzerIO.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerIO.cpp?rev=236548&r1=236547&r2=236548&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIO.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerIO.cpp Tue May 5 16:59:51 2015
@@ -60,4 +60,9 @@ std::string DirPlusFile(const std::strin
return DirPath + "/" + FileName;
}
+void PrintFileAsBase64(const std::string &Path) {
+ std::string Cmd = "base64 -w 0 < " + Path + "; echo";
+ system(Cmd.c_str());
+}
+
} // namespace fuzzer
Modified: llvm/trunk/lib/Fuzzer/FuzzerInternal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerInternal.h?rev=236548&r1=236547&r2=236548&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerInternal.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerInternal.h Tue May 5 16:59:51 2015
@@ -40,6 +40,7 @@ void Print(const Unit &U, const char *Pr
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:
Modified: llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp?rev=236548&r1=236547&r2=236548&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp Tue May 5 16:59:51 2015
@@ -246,6 +246,8 @@ void Fuzzer::WriteToCrash(const Unit &U,
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() {
More information about the llvm-commits
mailing list