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:
0diff --git a/src/wallet/test/fuzz/wallet_bdb_parser.cpp b/src/wallet/test/fuzz/wallet_bdb_parser.cpp
1index aabde093b6..a1acb95178 100644
2--- a/src/wallet/test/fuzz/wallet_bdb_parser.cpp
3+++ b/src/wallet/test/fuzz/wallet_bdb_parser.cpp
4@@ -19,23 +19,15 @@ using wallet::DatabaseOptions;
5 using wallet::DatabaseStatus;
6
7 namespace {
8-const TestingSetup* g_setup;
9+TestingSetup* g_setup;
10 } // namespace
11
12 void initialize_wallet_bdb_parser()
13 {
14- static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>();
15+ static auto testing_setup = MakeNoLogFileContext<TestingSetup>();
16 g_setup = testing_setup.get();
17 }
18
19-void SetDumpFile(ArgsManager& args) {
20- auto dumpfile{args.GetDataDirNet() / "fuzzed_dumpfile.dat"};
21- if (fs::exists(dumpfile)) { // Writing into an existing dump file will throw an exception
22- remove(dumpfile);
23- }
24- args.ForceSetArg("-dumpfile", fs::PathToString(args.GetDataDirNet() / "fuzzed_dumpfile.dat"));
25-}
26-
27 FUZZ_TARGET_INIT(wallet_bdb_parser, initialize_wallet_bdb_parser)
28 {
29 FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
30@@ -52,10 +44,14 @@ FUZZ_TARGET_INIT(wallet_bdb_parser, initialize_wallet_bdb_parser)
31 DatabaseStatus status;
32 bilingual_str error;
33
34+ auto dumpfile{g_setup->m_args.GetDataDirNet() / "fuzzed_dumpfile.dat"};
35+ if (fs::exists(dumpfile)) { // Writing into an existing dump file will throw an exception
36+ remove(dumpfile);
37+ }
38+ g_setup->m_args.ForceSetArg("-dumpfile", dumpfile);
39+
40 try {
41 auto db{MakeBerkeleyRODatabase(wallet_path, options, status, error)};
42- const auto& node = g_setup->m_node;
43- SetDumpFile(*node.args);
44 assert(DumpWallet(g_setup->m_args, *db, error));
45 }
46 catch (const std::runtime_error& e) {