34 const auto wallet_path =
g_setup->m_args.GetDataDirNet() /
"fuzzed_wallet.dat";
38 outfile << std::span{buffer};
46 fs::path bdb_ro_dumpfile{
g_setup->m_args.GetDataDirNet() /
"fuzzed_dumpfile_bdb_ro.dump"};
47 if (fs::exists(bdb_ro_dumpfile)) {
48 remove(bdb_ro_dumpfile);
50 g_setup->m_args.ForceSetArg(
"-dumpfile", fs::PathToString(bdb_ro_dumpfile));
52 auto db{MakeBerkeleyRODatabase(wallet_path, options, status, error)};
56 if (error.
original.starts_with(
"AutoFile::ignore: end of file") ||
57 error.
original.starts_with(
"AutoFile::read: end of file") ||
58 error.
original.starts_with(
"AutoFile::seek: ") ||
59 error.
original ==
"Not a BDB file" ||
60 error.
original ==
"Unexpected page type, should be 9 (BTree Metadata)" ||
61 error.
original ==
"Unexpected database flags, should only be 0x20 (subdatabases)" ||
62 error.
original ==
"Unexpected outer database root page type" ||
63 error.
original ==
"Unexpected number of entries in outer database root page" ||
64 error.
original ==
"Subdatabase page number has unexpected length" ||
65 error.
original ==
"Unknown record type in records page" ||
66 error.
original ==
"Unknown record type in internal page" ||
67 error.
original ==
"Unexpected page size" ||
68 error.
original ==
"Unexpected page type" ||
69 error.
original ==
"Page number mismatch" ||
70 error.
original ==
"Bad btree level" ||
72 error.
original ==
"Meta page number mismatch" ||
73 error.
original ==
"Data record position not in page" ||
74 error.
original ==
"Internal record position not in page" ||
75 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" ||
76 error.
original ==
"Records page has odd number of records" ||
77 error.
original ==
"Bad overflow record page type") {
79 }
else if (error.
original ==
"Subdatabase last page is greater than database last page" ||
80 error.
original ==
"Page number is greater than database last page" ||
81 error.
original ==
"Last page number could not fit in file" ||
82 error.
original ==
"Subdatabase has an unexpected name" ||
83 error.
original ==
"Unsupported BDB data file version number" ||
84 error.
original ==
"BDB builtin encryption is not supported") {
86 throw std::runtime_error(error.
original);