mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 02:02:42 +02:00
Merge bitcoin/bitcoin#32588: util: Abort on failing CHECK_NONFATAL in debug builds
fa37153288util: Abort on failing CHECK_NONFATAL in debug builds (MarcoFalke)fa0dc4bdfftest: Allow testing of check failures (MarcoFalke)faeb58fe66refactor: Set G_ABORT_ON_FAILED_ASSUME when G_FUZZING_BUILD (MarcoFalke) Pull request description: A failing `CHECK_NONFATAL` will throw an exception. This is fine and even desired in production builds, because the program may catch the exception and give the user a way to easily report the bug upstream. However, in debug development builds, exceptions for internal bugs are problematic: * The exception could accidentally be caught and silently ignored * The exception does not include a full stacktrace, possibly making debugging harder Fix all issues by turning the exception into an abort in debug builds. This can be tested by reverting the hunks to `src/rpc/node.cpp` and `test/functional/rpc_misc.py` and then running the functional or fuzz tests. ACKs for top commit: achow101: ACKfa37153288ryanofsky: Code review ACKfa37153288, just catching subprocess.CalledProcessError in test fixing up a comment since last review stickies-v: ACKfa37153288Tree-SHA512: 2d892b838ccef6f9b25a066e7c2f6cd6f5acc94aad1d91fce62308983bd3f5c5d724897a76de4e3cc5c3678ddadc87e2ee8c87362965373526038e598dfb0101
This commit is contained in:
@@ -251,9 +251,4 @@ FUZZ_TARGET(integer, .init = initialize_integer)
|
||||
} catch (const std::ios_base::failure&) {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
CHECK_NONFATAL(b);
|
||||
} catch (const NonFatalCheckError&) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,6 +381,12 @@ FUZZ_TARGET(rpc, .init = initialize_rpc)
|
||||
arguments.push_back(ConsumeRPCArgument(fuzzed_data_provider, good_data));
|
||||
}
|
||||
try {
|
||||
std::optional<test_only_CheckFailuresAreExceptionsNotAborts> maybe_mock{};
|
||||
if (rpc_command == "echo") {
|
||||
// Avoid aborting fuzzing for this specific test-only RPC with an
|
||||
// intentional trigger_internal_bug
|
||||
maybe_mock.emplace();
|
||||
}
|
||||
rpc_testing_setup->CallRPC(rpc_command, arguments);
|
||||
} catch (const UniValue& json_rpc_error) {
|
||||
const std::string error_msg{json_rpc_error.find_value("message").get_str()};
|
||||
|
||||
Reference in New Issue
Block a user