[lib/Fuzzer] on crash print the contents of the crashy input as base64
[oota-llvm.git] / lib / Fuzzer / FuzzerIO.cpp
index ef23d42ea53a5110fa44de550e9e560feb60030c..81f37aa3c0137b2e73959f22d4b555b16384e785 100644 (file)
@@ -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