summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2017-08-29 20:51:24 +0000
committerKostya Serebryany <kcc@google.com>2017-08-29 20:51:24 +0000
commit4faeb87ebe8942dc7b997f763ed8899a0bcfb963 (patch)
treed1fda38568b208ee45f5b4ed1b257aafeea8e595 /compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp
parentc29c2c9b0c194fd27c25da00929bac91f7d6dbd5 (diff)
downloadbcm5719-llvm-4faeb87ebe8942dc7b997f763ed8899a0bcfb963.tar.gz
bcm5719-llvm-4faeb87ebe8942dc7b997f763ed8899a0bcfb963.zip
[libFUzzer] change the way we load the seed corpora: instead of loading all files and these executing all files, load and execute them one-by-one. This should reduce the memory usage in many cases
llvm-svn: 312033
Diffstat (limited to 'compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp')
-rw-r--r--compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp b/compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp
index d642b342469..2c452a7dd8d 100644
--- a/compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp
@@ -32,6 +32,13 @@ bool IsFile(const std::string &Path) {
return S_ISREG(St.st_mode);
}
+size_t FileSize(const std::string &Path) {
+ struct stat St;
+ if (stat(Path.c_str(), &St))
+ return 0;
+ return St.st_size;
+}
+
void ListFilesInDirRecursive(const std::string &Dir, long *Epoch,
Vector<std::string> *V, bool TopDir) {
auto E = GetEpoch(Dir);
OpenPOWER on IntegriCloud