28 static auto testing_setup = MakeNoLogFileContext<TestingSetup>();
29 g_setup = testing_setup.get();
34 const auto wallet_path = g_setup->m_args.GetDataDirNet() /
"fuzzed_wallet.dat";
38 outfile << std::span{buffer};
45 fs::path bdb_ro_dumpfile{g_setup->m_args.GetDataDirNet() /
"fuzzed_dumpfile_bdb_ro.dump"};
47 remove(bdb_ro_dumpfile);
55 if (error.
original.starts_with(
"AutoFile::ignore: end of file") ||
56 error.
original.starts_with(
"AutoFile::read: end of file") ||
57 error.
original.starts_with(
"AutoFile::seek: ") ||
58 error.
original ==
"Not a BDB file" ||
59 error.
original ==
"Unexpected page type, should be 9 (BTree Metadata)" ||
60 error.
original ==
"Unexpected database flags, should only be 0x20 (subdatabases)" ||
61 error.
original ==
"Unexpected outer database root page type" ||
62 error.
original ==
"Unexpected number of entries in outer database root page" ||
63 error.
original ==
"Subdatabase page number has unexpected length" ||
64 error.
original ==
"Unknown record type in records page" ||
65 error.
original ==
"Unknown record type in internal page" ||
66 error.
original ==
"Unexpected page size" ||
67 error.
original ==
"Unexpected page type" ||
68 error.
original ==
"Page number mismatch" ||
69 error.
original ==
"Bad btree level" ||
71 error.
original ==
"Meta page number mismatch" ||
72 error.
original ==
"Data record position not in page" ||
73 error.
original ==
"Internal record position not in page" ||
74 error.
original ==
"LSNs are not reset, this database is not completely flushed. Please reopen then close the database with a version that has BDB support" ||
75 error.
original ==
"Records page has odd number of records" ||
76 error.
original ==
"Bad overflow record page type") {
78 }
else if (error.
original ==
"Subdatabase last page is greater than database last page" ||
79 error.
original ==
"Page number is greater than database last page" ||
80 error.
original ==
"Last page number could not fit in file" ||
81 error.
original ==
"Subdatabase has an unexpected name" ||
82 error.
original ==
"Unsupported BDB data file version number" ||
83 error.
original ==
"BDB builtin encryption is not supported") {
85 throw std::runtime_error(error.
original);
Non-refcounted RAII wrapper for FILE*.
static bool exists(const path &p)
static std::string PathToString(const path &path)
Convert path object to a byte string.
FILE * fopen(const fs::path &p, const char *mode)
bool DumpWallet(const ArgsManager &args, WalletDatabase &db, bilingual_str &error)
std::unique_ptr< BerkeleyRODatabase > MakeBerkeleyRODatabase(const fs::path &path, const DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error)
Return object giving access to Berkeley Read Only database at specified path.
Testing setup that configures a complete environment.
FUZZ_TARGET(wallet_bdb_parser,.init=initialize_wallet_bdb_parser)
void initialize_wallet_bdb_parser()