diff --git a/centipede/centipede_interface.cc b/centipede/centipede_interface.cc index 386e9222..0a3917c1 100644 --- a/centipede/centipede_interface.cc +++ b/centipede/centipede_interface.cc @@ -775,7 +775,11 @@ int CentipedeMain(const Environment& env, }(); Environment updated_env = env; if (updated_env.fuzztest_corpus_database.empty()) { - FUZZTEST_CHECK_OK(serialized_target_config.status()); + if (!serialized_target_config.ok()) { + FUZZTEST_LOG(ERROR) << "Failed to get the serialized target config: " + << serialized_target_config.status(); + return EXIT_FAILURE; + } if (!serialized_target_config->empty()) { const auto target_config = fuzztest::internal::Configuration::Deserialize( diff --git a/fuzztest/internal/centipede_adaptor.cc b/fuzztest/internal/centipede_adaptor.cc index bc505a6a..bfd67dc5 100644 --- a/fuzztest/internal/centipede_adaptor.cc +++ b/fuzztest/internal/centipede_adaptor.cc @@ -390,6 +390,8 @@ void InstallCentipedeTerminationHandler() { int RunCentipede(const Environment& env, const std::optional& centipede_command) { + FUZZTEST_CHECK(!IsCentipedeRunner()) + << "Unexpected RunCentipede() in runner mode."; if (Runtime::instance().termination_requested()) { absl::FPrintF(GetStderr(), "Not running Centipede due to termination requested - " @@ -908,11 +910,6 @@ bool CentipedeFuzzerAdaptor::Run(int* argc, char*** argv, RunMode mode, CentipedeSetFailureDescription(std::string{crash_type}.c_str()); }); } - if (!configuration.corpus_database.empty() && - configuration.crashing_input_to_reproduce.has_value() && - configuration.replay_in_single_process) { - return ReplayCrashInSingleProcess(configuration); - } if (runner_mode) { std::optional result; fuzzer_impl_.fixture_driver_->RunFuzzTest([&, this]() { @@ -928,7 +925,13 @@ bool CentipedeFuzzerAdaptor::Run(int* argc, char*** argv, RunMode mode, FUZZTEST_CHECK(result.has_value()) << "No result is set for running fuzz test"; return *result == EXIT_SUCCESS; - } else if (is_running_property_function_in_this_process) { + } + if (!configuration.corpus_database.empty() && + configuration.crashing_input_to_reproduce.has_value() && + configuration.replay_in_single_process) { + return ReplayCrashInSingleProcess(configuration); + } + if (is_running_property_function_in_this_process) { // If `is_running_property_function_in_this_process` holds at this point. We // assume it is for `ReplayInputsIfAvailable` to handle `FUZZTEST_REPLAY` // and `FUZZTEST_MINIMIZE_REPRODUCER`, which Centipede does not support.