After testing with a valid database in the fuzzing corpus, I noticed that I messed up the m_args, m_node.args, gArgs division again (see here) - sorry about that. I have a basic patch here, but feel free to commit a more elegant fix:
diff --git a/src/wallet/test/fuzz/wallet_bdb_parser.cpp b/src/wallet/test/fuzz/wallet_bdb_parser.cpp
index aabde093b6..a1acb95178 100644
--- a/src/wallet/test/fuzz/wallet_bdb_parser.cpp
+++ b/src/wallet/test/fuzz/wallet_bdb_parser.cpp
@@ -19,23 +19,15 @@ using wallet::DatabaseOptions;
using wallet::DatabaseStatus;
namespace {
-const TestingSetup* g_setup;
+TestingSetup* g_setup;
} // namespace
void initialize_wallet_bdb_parser()
{
- static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>();
+ static auto testing_setup = MakeNoLogFileContext<TestingSetup>();
g_setup = testing_setup.get();
}
-void SetDumpFile(ArgsManager& args) {
- auto dumpfile{args.GetDataDirNet() / "fuzzed_dumpfile.dat"};
- if (fs::exists(dumpfile)) { // Writing into an existing dump file will throw an exception
- remove(dumpfile);
- }
- args.ForceSetArg("-dumpfile", fs::PathToString(args.GetDataDirNet() / "fuzzed_dumpfile.dat"));
-}
-
FUZZ_TARGET_INIT(wallet_bdb_parser, initialize_wallet_bdb_parser)
{
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
@@ -52,10 +44,14 @@ FUZZ_TARGET_INIT(wallet_bdb_parser, initialize_wallet_bdb_parser)
DatabaseStatus status;
bilingual_str error;
+ auto dumpfile{g_setup->m_args.GetDataDirNet() / "fuzzed_dumpfile.dat"};
+ if (fs::exists(dumpfile)) { // Writing into an existing dump file will throw an exception
+ remove(dumpfile);
+ }
+ g_setup->m_args.ForceSetArg("-dumpfile", dumpfile);
+
try {
auto db{MakeBerkeleyRODatabase(wallet_path, options, status, error)};
- const auto& node = g_setup->m_node;
- SetDumpFile(*node.args);
assert(DumpWallet(g_setup->m_args, *db, error));
}
catch (const std::runtime_error& e) {