Skip to content

Commit 7e584f6

Browse files
Merge dashpay#6624: backport: Merge bitcoin#22508, 26009, 25831, 24675
3934e13 Merge bitcoin#24675: util: Use ArgsManager::GetPathArg more widely (fanquake) 3a6683c Merge bitcoin#25831: refactor: Remove trailing semicolon from LOCK2 macro (MacroFake) cc52355 Merge bitcoin#26009: test: remove Boost Test from libtest_util (MacroFake) 85b575f Merge bitcoin#22508: fuzz: replace every fuzzer-controlled while loop with a macro (MarcoFalke) Pull request description: BTC Backport ACKs for top commit: UdjinM6: utACK 3934e13 Tree-SHA512: 088d57a1f08c60896fb34ce1ced73d7594e92d646f0fb10ceeefb52b52ab490338e9fa2b9b247993c17b4d853996eebe89e750352a24bd145e894c7aea534bd9
2 parents e60dc86 + 3934e13 commit 7e584f6

34 files changed

+51
-52
lines changed

src/bitcoin-cli.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ static UniValue CallRPC(BaseRequestHandler* rh, const std::string& strMethod, co
837837
if (failedToGetAuthCookie) {
838838
throw std::runtime_error(strprintf(
839839
"Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set. See -rpcpassword and -stdinrpcpass. Configuration file: (%s)",
840-
fs::PathToString(GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)))));
840+
fs::PathToString(GetConfigFile(gArgs.GetPathArg("-conf", BITCOIN_CONF_FILENAME)))));
841841
} else {
842842
throw std::runtime_error("Authorization failed: Incorrect rpcuser or rpcpassword");
843843
}

src/init/common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ bool StartLogging(const ArgsManager& args)
159159
LogPrintf("Using data directory %s\n", fs::PathToString(gArgs.GetDataDirNet()));
160160

161161
// Only log conf file usage message if conf file actually exists.
162-
fs::path config_file_path = GetConfigFile(args.GetArg("-conf", BITCOIN_CONF_FILENAME));
162+
fs::path config_file_path = GetConfigFile(args.GetPathArg("-conf", BITCOIN_CONF_FILENAME));
163163
if (fs::exists(config_file_path)) {
164164
LogPrintf("Config file: %s\n", fs::PathToString(config_file_path));
165165
} else if (args.IsArgSet("-conf")) {

src/qt/guiutil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ void openDebugLogfile()
652652

653653
void openConfigfile()
654654
{
655-
fs::path pathConfig = GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME));
655+
fs::path pathConfig = GetConfigFile(gArgs.GetPathArg("-conf", BITCOIN_CONF_FILENAME));
656656

657657
/* Open dash.conf with the associated application */
658658
if (fs::exists(pathConfig)) {

src/rpc/request.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ UniValue JSONRPCError(int code, const std::string& message)
6666
*/
6767
static const std::string COOKIEAUTH_USER = "__cookie__";
6868
/** Default name for auth cookie file */
69-
static const std::string COOKIEAUTH_FILE = ".cookie";
69+
static const char* const COOKIEAUTH_FILE = ".cookie";
7070

7171
/** Get name of RPC authentication cookie file */
7272
static fs::path GetAuthCookieFile(bool temp=false)
7373
{
74-
std::string arg = gArgs.GetArg("-rpccookiefile", COOKIEAUTH_FILE);
74+
fs::path arg = gArgs.GetPathArg("-rpccookiefile", COOKIEAUTH_FILE);
7575
if (temp) {
7676
arg += ".tmp";
7777
}
78-
return AbsPathForConfigVal(fs::PathFromString(arg));
78+
return AbsPathForConfigVal(arg);
7979
}
8080

8181
bool GenerateAuthCookie(std::string *cookie_out)

src/sync.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ using ReadLock = SharedLock<typename std::remove_reference<typename std::remove_
313313
#define READ_LOCK(cs) ReadLock<decltype(cs)> UNIQUE_NAME(criticalblock)(cs, #cs, __FILE__, __LINE__)
314314
#define LOCK2(cs1, cs2) \
315315
DebugLock<decltype(cs1)> criticalblock1(cs1, #cs1, __FILE__, __LINE__); \
316-
DebugLock<decltype(cs2)> criticalblock2(cs2, #cs2, __FILE__, __LINE__);
316+
DebugLock<decltype(cs2)> criticalblock2(cs2, #cs2, __FILE__, __LINE__)
317317
#define TRY_LOCK(cs, name) DebugLock<decltype(cs)> name(cs, #cs, __FILE__, __LINE__, true)
318318
#define TRY_READ_LOCK(cs, name) ReadLock<decltype(cs)> name(cs, #cs, __FILE__, __LINE__, true)
319319
#define WAIT_LOCK(cs, name) DebugLock<decltype(cs)> name(cs, #cs, __FILE__, __LINE__)

src/test/fuzz/addrman.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ FUZZ_TARGET(addrman, .init = initialize_addrman)
250250
}
251251
}
252252
AddrManDeterministic& addr_man = *addr_man_ptr;
253-
while (fuzzed_data_provider.ConsumeBool()) {
253+
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
254254
CallOneOf(
255255
fuzzed_data_provider,
256256
[&] {
@@ -270,7 +270,7 @@ FUZZ_TARGET(addrman, .init = initialize_addrman)
270270
},
271271
[&] {
272272
std::vector<CAddress> addresses;
273-
while (fuzzed_data_provider.ConsumeBool()) {
273+
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
274274
const std::optional<CAddress> opt_address = ConsumeDeserializable<CAddress>(fuzzed_data_provider);
275275
if (!opt_address) {
276276
break;

src/test/fuzz/autofile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ FUZZ_TARGET(autofile)
1818
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
1919
FuzzedAutoFileProvider fuzzed_auto_file_provider = ConsumeAutoFile(fuzzed_data_provider);
2020
CAutoFile auto_file = fuzzed_auto_file_provider.open();
21-
while (fuzzed_data_provider.ConsumeBool()) {
21+
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
2222
CallOneOf(
2323
fuzzed_data_provider,
2424
[&] {

src/test/fuzz/bloom_filter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ FUZZ_TARGET(bloom_filter)
2424
1.0 / fuzzed_data_provider.ConsumeIntegralInRange<unsigned int>(1, std::numeric_limits<unsigned int>::max()),
2525
fuzzed_data_provider.ConsumeIntegral<unsigned int>(),
2626
static_cast<unsigned char>(fuzzed_data_provider.PickValueInArray({BLOOM_UPDATE_NONE, BLOOM_UPDATE_ALL, BLOOM_UPDATE_P2PUBKEY_ONLY, BLOOM_UPDATE_MASK}))};
27-
while (fuzzed_data_provider.remaining_bytes() > 0) {
27+
LIMITED_WHILE(fuzzed_data_provider.remaining_bytes() > 0, 10000) {
2828
CallOneOf(
2929
fuzzed_data_provider,
3030
[&] {

src/test/fuzz/buffered_file.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ FUZZ_TARGET(buffered_file)
2929
}
3030
if (opt_buffered_file && fuzzed_file != nullptr) {
3131
bool setpos_fail = false;
32-
while (fuzzed_data_provider.ConsumeBool()) {
32+
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
3333
CallOneOf(
3434
fuzzed_data_provider,
3535
[&] {

src/test/fuzz/chain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ FUZZ_TARGET(chain)
3737
(void)CDiskBlockIndex{*disk_block_index};
3838
(void)disk_block_index->BuildSkip();
3939

40-
while (fuzzed_data_provider.ConsumeBool()) {
40+
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
4141
const BlockStatus block_status = fuzzed_data_provider.PickValueInArray({
4242
BlockStatus::BLOCK_VALID_UNKNOWN,
4343
BlockStatus::BLOCK_VALID_RESERVED,

0 commit comments

Comments
 (0)