[libFuzzer] honor -exact_artifact_path for all intermediate files during crash minimization (https://github.com/google/oss-fuzz/issues/250)

llvm-svn: 298740
This commit is contained in:
Kostya Serebryany 2017-03-24 21:09:16 +00:00
parent ccc075ca20
commit dba9ded61f
2 changed files with 6 additions and 3 deletions

View File

@ -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());

View File

@ -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