diff options
author | Kostya Serebryany <kcc@google.com> | 2017-03-24 21:09:16 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2017-03-24 21:09:16 +0000 |
commit | dba9ded61f0bf5d6a809919f74fc30534f66081a (patch) | |
tree | c012c9a4725132495bba9d46cda2ca15634bc60d | |
parent | ccc075ca206f7b80493bd8612b297004ff6e7164 (diff) | |
download | bcm5719-llvm-dba9ded61f0bf5d6a809919f74fc30534f66081a.tar.gz bcm5719-llvm-dba9ded61f0bf5d6a809919f74fc30534f66081a.zip |
[libFuzzer] honor -exact_artifact_path for all intermediate files during crash minimization (https://github.com/google/oss-fuzz/issues/250)
llvm-svn: 298740
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerDriver.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Fuzzer/test/minimize_crash.test | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerDriver.cpp b/llvm/lib/Fuzzer/FuzzerDriver.cpp index e837eb5ff22..a4e16bad916 100644 --- a/llvm/lib/Fuzzer/FuzzerDriver.cpp +++ b/llvm/lib/Fuzzer/FuzzerDriver.cpp @@ -317,7 +317,9 @@ int MinimizeCrashInput(const std::vector<std::string> &Args, CurrentFilePath.c_str(), U.size()); std::string ArtifactPath = - Options.ArtifactPrefix + "minimized-from-" + Hash(U); + Flags.exact_artifact_path + ? Flags.exact_artifact_path + : Options.ArtifactPrefix + "minimized-from-" + Hash(U); Cmd += " -minimize_crash_internal_step=1 -exact_artifact_path=" + ArtifactPath; Printf("CRASH_MIN: executing: %s\n", Cmd.c_str()); diff --git a/llvm/lib/Fuzzer/test/minimize_crash.test b/llvm/lib/Fuzzer/test/minimize_crash.test index 7d60ea65385..5643c6bacb0 100644 --- a/llvm/lib/Fuzzer/test/minimize_crash.test +++ b/llvm/lib/Fuzzer/test/minimize_crash.test @@ -6,7 +6,8 @@ CHECK_EXACT: CRASH_MIN: failed to minimize beyond exact_minimized_path (3 bytes) RUN: rm not_minimal_crash minimized-from-* exact_minimized_path RUN: echo -n 'abcd*xyz' > not_minimal_crash -RUN: LLVMFuzzer-SingleByteInputTest -minimize_crash=1 not_minimal_crash -artifact_prefix=./ZZZ- -exact_artifact_path=exact_minimized_path 2>&1 | FileCheck %s --check-prefix=MIN1 -MIN1: Test unit written to ./ZZZ-minimized-from- +RUN: LLVMFuzzer-SingleByteInputTest -minimize_crash=1 not_minimal_crash -exact_artifact_path=exact_minimized_path 2>&1 | FileCheck %s --check-prefix=MIN1 +MIN1: Test unit written to exact_minimized_path +MIN1: Test unit written to exact_minimized_path MIN1: INFO: The input is small enough, exiting MIN1: CRASH_MIN: failed to minimize beyond exact_minimized_path (1 bytes), exiting |