summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-02-02 02:07:26 +0000
committerKostya Serebryany <kcc@google.com>2016-02-02 02:07:26 +0000
commit078e984d8d8f05a525c3322a9adf49857d5b5f83 (patch)
tree37c82dbb3dcf03a7fa055458d74620634a868546
parente67b402e4544dd6837db8f5b9cdaff3f60fb34c9 (diff)
downloadbcm5719-llvm-078e984d8d8f05a525c3322a9adf49857d5b5f83.tar.gz
bcm5719-llvm-078e984d8d8f05a525c3322a9adf49857d5b5f83.zip
[libFuzzer] fail if the corpus dir does not exist
llvm-svn: 259454
-rw-r--r--llvm/lib/Fuzzer/FuzzerIO.cpp2
-rw-r--r--llvm/lib/Fuzzer/test/fuzzer.test3
2 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerIO.cpp b/llvm/lib/Fuzzer/FuzzerIO.cpp
index 043fad396d5..cc65876f241 100644
--- a/llvm/lib/Fuzzer/FuzzerIO.cpp
+++ b/llvm/lib/Fuzzer/FuzzerIO.cpp
@@ -32,7 +32,7 @@ static std::vector<std::string> ListFilesInDir(const std::string &Dir,
std::vector<std::string> V;
if (Epoch) {
auto E = GetEpoch(Dir);
- if (*Epoch >= E) return V;
+ if (E && *Epoch >= E) return V;
*Epoch = E;
}
DIR *D = opendir(Dir.c_str());
diff --git a/llvm/lib/Fuzzer/test/fuzzer.test b/llvm/lib/Fuzzer/test/fuzzer.test
index 5754058cf69..86ef32a2af3 100644
--- a/llvm/lib/Fuzzer/test/fuzzer.test
+++ b/llvm/lib/Fuzzer/test/fuzzer.test
@@ -42,3 +42,6 @@ RUN: not LLVMFuzzer-InitializeTest 2>&1 | FileCheck %s
RUN: LLVMFuzzer-SimpleCmpTest -seed=-1 -runs=0 2>&1 | FileCheck %s --check-prefix=CHECK_SEED_MINUS_ONE
CHECK_SEED_MINUS_ONE: Seed: 4294967295
+
+RUN: not LLVMFuzzer-SimpleTest NONEXISTENT_DIR 2>&1 | FileCheck %s --check-prefix=NONEXISTENT_DIR
+NONEXISTENT_DIR: No such directory: NONEXISTENT_DIR; exiting
OpenPOWER on IntegriCloud