diff options
author | Kostya Serebryany <kcc@google.com> | 2019-04-13 00:20:31 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2019-04-13 00:20:31 +0000 |
commit | c438ef37dfc4b954ead9df6222fe0bb36987268e (patch) | |
tree | d87619a6ebc6ebe668b6f2757ca4be8a8f97ff32 /lib/fuzzer/FuzzerIO.cpp | |
parent | 8fa46946cfbe3eb0e23dde603799e9af586fe374 (diff) | |
download | compiler-rt-c438ef37dfc4b954ead9df6222fe0bb36987268e.tar.gz |
[libFuzzer] add -features_dir= flag to dump unique input features on disk
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@358317 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/fuzzer/FuzzerIO.cpp')
-rw-r--r-- | lib/fuzzer/FuzzerIO.cpp | 6 |
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); } |