Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion fuzztest/init_fuzztest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,14 @@ internal::Configuration CreateConfigurationsFromFlags(
FUZZTEST_CHECK(!jobs.has_value() || *jobs > 0)
<< "If specified, --" << FUZZTEST_FLAG(jobs).Name()
<< " must be positive.";
std::string corpus_database = absl::GetFlag(FUZZTEST_FLAG(corpus_database));
if (!corpus_database.empty() && corpus_database[0] != '/' &&
std::getenv("TEST_SRCDIR")) {
corpus_database =
absl::StrCat(std::getenv("TEST_SRCDIR"), "/", corpus_database);
}
return internal::Configuration{
absl::GetFlag(FUZZTEST_FLAG(corpus_database)),
corpus_database,
/*stats_root=*/"",
/*workdir_root=*/"",
std::string(binary_identifier),
Expand Down
8 changes: 5 additions & 3 deletions fuzztest/internal/centipede_adaptor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -491,9 +491,9 @@ class CentipedeAdaptorRunnerCallbacks
if (parsed_input.ok()) {
fuzzer_impl_.RunOneInput({*std::move(parsed_input)});
if (runtime_.external_failure_detected()) {
absl::FPrintF(GetStderr(),
"[!] External failure detected - aborting.\n");
std::abort();
// This would take effect only if no previous description is set.
CentipedeSetFailureDescription(
"INPUT FAILURE: external failure detected.");
}
return true;
}
Expand Down Expand Up @@ -691,6 +691,8 @@ bool CentipedeFuzzerAdaptor::RunInFuzzingMode(

bool CentipedeFuzzerAdaptor::ReplayCrashInSingleProcess(
const Configuration& configuration) {
// Follow the legacy engine behavior to force fuzzing mode.
runtime_.SetRunMode(RunMode::kFuzz);
TempDir crash_export_dir("fuzztest_crash");
auto export_crash_env = CreateCentipedeEnvironmentFromConfiguration(
configuration, /*workdir=*/"", test_.full_name(), runtime_.run_mode());
Expand Down
9 changes: 1 addition & 8 deletions fuzztest/internal/corpus_database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,7 @@ CorpusDatabase::CorpusDatabase(absl::string_view database_path,
bool use_crashing_inputs)
: corpus_path_for_test_binary_([=] () -> std::string {
if (database_path.empty()) return "";
std::string corpus_path_for_test_binary =
absl::StrCat(database_path, "/", binary_identifier);
if (!absl::StartsWith(corpus_path_for_test_binary, "/") &&
std::getenv("TEST_SRCDIR")) {
corpus_path_for_test_binary = absl::StrCat(
std::getenv("TEST_SRCDIR"), "/", corpus_path_for_test_binary);
}
return corpus_path_for_test_binary;
return absl::StrCat(database_path, "/", binary_identifier);
}()),
use_crashing_inputs_(use_crashing_inputs) {}

Expand Down