mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
fuzz: Don't compile BDB-specific code on MSVC in wallet_bdb_parser.cpp
This commit is contained in:
parent
e07a3ede52
commit
c07fdd6546
1 changed files with 11 additions and 4 deletions
|
@ -18,6 +18,13 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
// There is an inconsistency in BDB on Windows.
|
||||||
|
// See: https://github.com/bitcoin/bitcoin/pull/26606#issuecomment-2322763212
|
||||||
|
#undef USE_BDB_NON_MSVC
|
||||||
|
#if defined(USE_BDB) && !defined(_MSC_VER)
|
||||||
|
#define USE_BDB_NON_MSVC
|
||||||
|
#endif
|
||||||
|
|
||||||
using wallet::DatabaseOptions;
|
using wallet::DatabaseOptions;
|
||||||
using wallet::DatabaseStatus;
|
using wallet::DatabaseStatus;
|
||||||
|
|
||||||
|
@ -50,7 +57,7 @@ FUZZ_TARGET(wallet_bdb_parser, .init = initialize_wallet_bdb_parser)
|
||||||
}
|
}
|
||||||
g_setup->m_args.ForceSetArg("-dumpfile", fs::PathToString(bdb_ro_dumpfile));
|
g_setup->m_args.ForceSetArg("-dumpfile", fs::PathToString(bdb_ro_dumpfile));
|
||||||
|
|
||||||
#ifdef USE_BDB
|
#ifdef USE_BDB_NON_MSVC
|
||||||
bool bdb_ro_err = false;
|
bool bdb_ro_err = false;
|
||||||
bool bdb_ro_strict_err = false;
|
bool bdb_ro_strict_err = false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -58,7 +65,7 @@ FUZZ_TARGET(wallet_bdb_parser, .init = initialize_wallet_bdb_parser)
|
||||||
if (db) {
|
if (db) {
|
||||||
assert(DumpWallet(g_setup->m_args, *db, error));
|
assert(DumpWallet(g_setup->m_args, *db, error));
|
||||||
} else {
|
} else {
|
||||||
#ifdef USE_BDB
|
#ifdef USE_BDB_NON_MSVC
|
||||||
bdb_ro_err = true;
|
bdb_ro_err = true;
|
||||||
#endif
|
#endif
|
||||||
if (error.original.starts_with("AutoFile::ignore: end of file") ||
|
if (error.original.starts_with("AutoFile::ignore: end of file") ||
|
||||||
|
@ -90,7 +97,7 @@ FUZZ_TARGET(wallet_bdb_parser, .init = initialize_wallet_bdb_parser)
|
||||||
error.original == "Subdatabase has an unexpected name" ||
|
error.original == "Subdatabase has an unexpected name" ||
|
||||||
error.original == "Unsupported BDB data file version number" ||
|
error.original == "Unsupported BDB data file version number" ||
|
||||||
error.original == "BDB builtin encryption is not supported") {
|
error.original == "BDB builtin encryption is not supported") {
|
||||||
#ifdef USE_BDB
|
#ifdef USE_BDB_NON_MSVC
|
||||||
bdb_ro_strict_err = true;
|
bdb_ro_strict_err = true;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
@ -98,7 +105,7 @@ FUZZ_TARGET(wallet_bdb_parser, .init = initialize_wallet_bdb_parser)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_BDB
|
#ifdef USE_BDB_NON_MSVC
|
||||||
// Try opening with BDB
|
// Try opening with BDB
|
||||||
fs::path bdb_dumpfile{g_setup->m_args.GetDataDirNet() / "fuzzed_dumpfile_bdb.dump"};
|
fs::path bdb_dumpfile{g_setup->m_args.GetDataDirNet() / "fuzzed_dumpfile_bdb.dump"};
|
||||||
if (fs::exists(bdb_dumpfile)) { // Writing into an existing dump file will throw an exception
|
if (fs::exists(bdb_dumpfile)) { // Writing into an existing dump file will throw an exception
|
||||||
|
|
Loading…
Add table
Reference in a new issue