summaryrefslogtreecommitdiff
path: root/lib/fuzzer/FuzzerIO.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fuzzer/FuzzerIO.cpp')
-rw-r--r--lib/fuzzer/FuzzerIO.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/fuzzer/FuzzerIO.cpp b/lib/fuzzer/FuzzerIO.cpp
index 423ab4bef..a8140b601 100644
--- a/lib/fuzzer/FuzzerIO.cpp
+++ b/lib/fuzzer/FuzzerIO.cpp
@@ -61,10 +61,14 @@ void CopyFileToErr(const std::string &Path) {
}
void WriteToFile(const Unit &U, const std::string &Path) {
+ WriteToFile(U.data(), U.size(), Path);
+}
+
+void WriteToFile(const uint8_t *Data, size_t Size, const std::string &Path) {
// Use raw C interface because this function may be called from a sig handler.
FILE *Out = fopen(Path.c_str(), "wb");
if (!Out) return;
- fwrite(U.data(), sizeof(U[0]), U.size(), Out);
+ fwrite(Data, sizeof(Data[0]), Size, Out);
fclose(Out);
}