summaryrefslogtreecommitdiff
path: root/lib/fuzzer/FuzzerIO.cpp
diff options
context:
space:
mode:
authorJonathan Metzman <metzman@chromium.org>2018-11-06 23:25:25 +0000
committerJonathan Metzman <metzman@chromium.org>2018-11-06 23:25:25 +0000
commitdee33d807ae1aca6b1064828d6ff0a04a83bdad9 (patch)
tree4a1b9a2386cd52c56712b98d4f5e3b742c60a0b0 /lib/fuzzer/FuzzerIO.cpp
parentdeac139096c7d320a3e645f807592c18f88c0558 (diff)
downloadcompiler-rt-dee33d807ae1aca6b1064828d6ff0a04a83bdad9.tar.gz
[fuzzer] Read files as binary
Summary: Read corpus files as binary to avoid automatic conversions Reviewers: Dor1s, morehouse Reviewed By: Dor1s, morehouse Differential Revision: https://reviews.llvm.org/D54180 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@346279 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/fuzzer/FuzzerIO.cpp')
-rw-r--r--lib/fuzzer/FuzzerIO.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/fuzzer/FuzzerIO.cpp b/lib/fuzzer/FuzzerIO.cpp
index dac5ec658..c4c31e824 100644
--- a/lib/fuzzer/FuzzerIO.cpp
+++ b/lib/fuzzer/FuzzerIO.cpp
@@ -31,7 +31,7 @@ long GetEpoch(const std::string &Path) {
}
Unit FileToVector(const std::string &Path, size_t MaxSize, bool ExitOnError) {
- std::ifstream T(Path);
+ std::ifstream T(Path, std::ios::binary);
if (ExitOnError && !T) {
Printf("No such directory: %s; exiting\n", Path.c_str());
exit(1);
@@ -51,7 +51,7 @@ Unit FileToVector(const std::string &Path, size_t MaxSize, bool ExitOnError) {
}
std::string FileToString(const std::string &Path) {
- std::ifstream T(Path);
+ std::ifstream T(Path, std::ios::binary);
return std::string((std::istreambuf_iterator<char>(T)),
std::istreambuf_iterator<char>());
}