aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--depends/packages/native_clang.mk2
-rw-r--r--depends/packages/native_libtapi.mk1
-rw-r--r--src/init.cpp2
-rw-r--r--src/streams.h67
-rw-r--r--src/test/fuzz/string.cpp3
-rw-r--r--src/test/getarg_tests.cpp92
-rw-r--r--src/test/serialize_tests.cpp45
-rw-r--r--src/test/streams_tests.cpp43
-rw-r--r--src/util/strencodings.cpp1
-rw-r--r--src/util/system.cpp31
-rw-r--r--src/util/system.h10
-rw-r--r--src/wallet/load.cpp2
-rw-r--r--src/wallet/test/init_tests.cpp8
-rw-r--r--src/wallet/walletutil.cpp2
-rw-r--r--test/sanitizer_suppressions/ubsan3
15 files changed, 141 insertions, 171 deletions
diff --git a/depends/packages/native_clang.mk b/depends/packages/native_clang.mk
index 25ac77c1a3..23c8139262 100644
--- a/depends/packages/native_clang.mk
+++ b/depends/packages/native_clang.mk
@@ -2,11 +2,9 @@ package=native_clang
$(package)_version=10.0.1
$(package)_download_path=https://github.com/llvm/llvm-project/releases/download/llvmorg-$($(package)_version)
ifneq (,$(findstring aarch64,$(BUILD)))
-$(package)_download_file=clang+llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz
$(package)_file_name=clang+llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz
$(package)_sha256_hash=90dc69a4758ca15cd0ffa45d07fbf5bf4309d47d2c7745a9f0735ecffde9c31f
else
-$(package)_download_file=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-16.04.tar.xz
$(package)_file_name=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-16.04.tar.xz
$(package)_sha256_hash=48b83ef827ac2c213d5b64f5ad7ed082c8bcb712b46644e0dc5045c6f462c231
endif
diff --git a/depends/packages/native_libtapi.mk b/depends/packages/native_libtapi.mk
index 60b898da5f..1633213a42 100644
--- a/depends/packages/native_libtapi.mk
+++ b/depends/packages/native_libtapi.mk
@@ -1,7 +1,6 @@
package=native_libtapi
$(package)_version=664b8414f89612f2dfd35a9b679c345aa5389026
$(package)_download_path=https://github.com/tpoechtrager/apple-libtapi/archive
-$(package)_download_file=$($(package)_version).tar.gz
$(package)_file_name=$($(package)_version).tar.gz
$(package)_sha256_hash=62e419c12d1c9fad67cc1cd523132bc00db050998337c734c15bc8d73cc02b61
diff --git a/src/init.cpp b/src/init.cpp
index 330aab5184..6aef1f8149 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1150,7 +1150,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
LogPrintf("Using at most %i automatic connections (%i file descriptors available)\n", nMaxConnections, nFD);
// Warn about relative -datadir path.
- if (args.IsArgSet("-datadir") && !fs::PathFromString(args.GetArg("-datadir", "")).is_absolute()) {
+ if (args.IsArgSet("-datadir") && !args.GetPathArg("-datadir").is_absolute()) {
LogPrintf("Warning: relative datadir option '%s' specified, which will be interpreted relative to the " /* Continued */
"current working directory '%s'. This is fragile, because if bitcoin is started in the future "
"from a different location, it will be unable to locate the current data files. There could "
diff --git a/src/streams.h b/src/streams.h
index 2f26be6dd8..cf8b4eb96f 100644
--- a/src/streams.h
+++ b/src/streams.h
@@ -240,76 +240,9 @@ public:
const_reference operator[](size_type pos) const { return vch[pos + nReadPos]; }
reference operator[](size_type pos) { return vch[pos + nReadPos]; }
void clear() { vch.clear(); nReadPos = 0; }
- iterator insert(iterator it, const value_type x) { return vch.insert(it, x); }
- void insert(iterator it, size_type n, const value_type x) { vch.insert(it, n, x); }
value_type* data() { return vch.data() + nReadPos; }
const value_type* data() const { return vch.data() + nReadPos; }
- void insert(iterator it, std::vector<value_type>::const_iterator first, std::vector<value_type>::const_iterator last)
- {
- if (last == first) return;
- assert(last - first > 0);
- if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
- {
- // special case for inserting at the front when there's room
- nReadPos -= (last - first);
- memcpy(&vch[nReadPos], &first[0], last - first);
- }
- else
- vch.insert(it, first, last);
- }
-
- void insert(iterator it, const value_type* first, const value_type* last)
- {
- if (last == first) return;
- assert(last - first > 0);
- if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
- {
- // special case for inserting at the front when there's room
- nReadPos -= (last - first);
- memcpy(&vch[nReadPos], &first[0], last - first);
- }
- else
- vch.insert(it, first, last);
- }
-
- iterator erase(iterator it)
- {
- if (it == vch.begin() + nReadPos)
- {
- // special case for erasing from the front
- if (++nReadPos >= vch.size())
- {
- // whenever we reach the end, we take the opportunity to clear the buffer
- nReadPos = 0;
- return vch.erase(vch.begin(), vch.end());
- }
- return vch.begin() + nReadPos;
- }
- else
- return vch.erase(it);
- }
-
- iterator erase(iterator first, iterator last)
- {
- if (first == vch.begin() + nReadPos)
- {
- // special case for erasing from the front
- if (last == vch.end())
- {
- nReadPos = 0;
- return vch.erase(vch.begin(), vch.end());
- }
- else
- {
- nReadPos = (last - vch.begin());
- return last;
- }
- }
- else
- return vch.erase(first, last);
- }
-
inline void Compact()
{
vch.erase(vch.begin(), vch.begin() + nReadPos);
diff --git a/src/test/fuzz/string.cpp b/src/test/fuzz/string.cpp
index 8f071b71fe..ca57af25c4 100644
--- a/src/test/fuzz/string.cpp
+++ b/src/test/fuzz/string.cpp
@@ -145,7 +145,8 @@ FUZZ_TARGET(string)
(void)CopyrightHolders(random_string_1);
FeeEstimateMode fee_estimate_mode;
(void)FeeModeFromString(random_string_1, fee_estimate_mode);
- (void)FormatParagraph(random_string_1, fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 1000), fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 1000));
+ const auto width{fuzzed_data_provider.ConsumeIntegralInRange<size_t>(1, 1000)};
+ (void)FormatParagraph(random_string_1, width, fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, width));
(void)FormatSubVersion(random_string_1, fuzzed_data_provider.ConsumeIntegral<int>(), random_string_vector);
(void)GetDescriptorChecksum(random_string_1);
(void)HelpExampleCli(random_string_1, random_string_2);
diff --git a/src/test/getarg_tests.cpp b/src/test/getarg_tests.cpp
index d5142c8d74..597d774673 100644
--- a/src/test/getarg_tests.cpp
+++ b/src/test/getarg_tests.cpp
@@ -159,6 +159,98 @@ BOOST_AUTO_TEST_CASE(intarg)
BOOST_CHECK_EQUAL(m_local_args.GetIntArg("-bar", 11), 0);
}
+BOOST_AUTO_TEST_CASE(patharg)
+{
+ const auto dir = std::make_pair("-dir", ArgsManager::ALLOW_ANY);
+ SetupArgs({dir});
+ ResetArgs("");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), fs::path{});
+
+ const fs::path root_path{"/"};
+ ResetArgs("-dir=/");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), root_path);
+
+ ResetArgs("-dir=/.");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), root_path);
+
+ ResetArgs("-dir=/./");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), root_path);
+
+ ResetArgs("-dir=/.//");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), root_path);
+
+#ifdef WIN32
+ const fs::path win_root_path{"C:\\"};
+ ResetArgs("-dir=C:\\");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), win_root_path);
+
+ ResetArgs("-dir=C:/");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), win_root_path);
+
+ ResetArgs("-dir=C:\\\\");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), win_root_path);
+
+ ResetArgs("-dir=C:\\.");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), win_root_path);
+
+ ResetArgs("-dir=C:\\.\\");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), win_root_path);
+
+ ResetArgs("-dir=C:\\.\\\\");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), win_root_path);
+#endif
+
+ const fs::path absolute_path{"/home/user/.bitcoin"};
+ ResetArgs("-dir=/home/user/.bitcoin");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), absolute_path);
+
+ ResetArgs("-dir=/root/../home/user/.bitcoin");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), absolute_path);
+
+ ResetArgs("-dir=/home/./user/.bitcoin");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), absolute_path);
+
+ ResetArgs("-dir=/home/user/.bitcoin/");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), absolute_path);
+
+ ResetArgs("-dir=/home/user/.bitcoin//");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), absolute_path);
+
+ ResetArgs("-dir=/home/user/.bitcoin/.");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), absolute_path);
+
+ ResetArgs("-dir=/home/user/.bitcoin/./");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), absolute_path);
+
+ ResetArgs("-dir=/home/user/.bitcoin/.//");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), absolute_path);
+
+ const fs::path relative_path{"user/.bitcoin"};
+ ResetArgs("-dir=user/.bitcoin");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), relative_path);
+
+ ResetArgs("-dir=somewhere/../user/.bitcoin");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), relative_path);
+
+ ResetArgs("-dir=user/./.bitcoin");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), relative_path);
+
+ ResetArgs("-dir=user/.bitcoin/");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), relative_path);
+
+ ResetArgs("-dir=user/.bitcoin//");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), relative_path);
+
+ ResetArgs("-dir=user/.bitcoin/.");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), relative_path);
+
+ ResetArgs("-dir=user/.bitcoin/./");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), relative_path);
+
+ ResetArgs("-dir=user/.bitcoin/.//");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), relative_path);
+}
+
BOOST_AUTO_TEST_CASE(doubledash)
{
const auto foo = std::make_pair("-foo", ArgsManager::ALLOW_ANY);
diff --git a/src/test/serialize_tests.cpp b/src/test/serialize_tests.cpp
index 8b8133b689..2441847f99 100644
--- a/src/test/serialize_tests.cpp
+++ b/src/test/serialize_tests.cpp
@@ -215,51 +215,6 @@ BOOST_AUTO_TEST_CASE(noncanonical)
BOOST_CHECK_EXCEPTION(ReadCompactSize(ss), std::ios_base::failure, isCanonicalException);
}
-BOOST_AUTO_TEST_CASE(insert_delete)
-{
- constexpr auto B2I{[](std::byte b) { return std::to_integer<uint8_t>(b); }};
-
- // Test inserting/deleting bytes.
- CDataStream ss(SER_DISK, 0);
- BOOST_CHECK_EQUAL(ss.size(), 0U);
-
- ss.write(MakeByteSpan("\x00\x01\x02\xff").first(4));
- BOOST_CHECK_EQUAL(ss.size(), 4U);
-
- uint8_t c{11};
-
- // Inserting at beginning/end/middle:
- ss.insert(ss.begin(), std::byte{c});
- BOOST_CHECK_EQUAL(ss.size(), 5U);
- BOOST_CHECK_EQUAL(B2I(ss[0]), c);
- BOOST_CHECK_EQUAL(B2I(ss[1]), 0);
-
- ss.insert(ss.end(), std::byte{c});
- BOOST_CHECK_EQUAL(ss.size(), 6U);
- BOOST_CHECK_EQUAL(B2I(ss[4]), 0xff);
- BOOST_CHECK_EQUAL(B2I(ss[5]), c);
-
- ss.insert(ss.begin() + 2, std::byte{c});
- BOOST_CHECK_EQUAL(ss.size(), 7U);
- BOOST_CHECK_EQUAL(B2I(ss[2]), c);
-
- // Delete at beginning/end/middle
- ss.erase(ss.begin());
- BOOST_CHECK_EQUAL(ss.size(), 6U);
- BOOST_CHECK_EQUAL(B2I(ss[0]), 0);
-
- ss.erase(ss.begin()+ss.size()-1);
- BOOST_CHECK_EQUAL(ss.size(), 5U);
- BOOST_CHECK_EQUAL(B2I(ss[4]), 0xff);
-
- ss.erase(ss.begin()+1);
- BOOST_CHECK_EQUAL(ss.size(), 4U);
- BOOST_CHECK_EQUAL(B2I(ss[0]), 0);
- BOOST_CHECK_EQUAL(B2I(ss[1]), 1);
- BOOST_CHECK_EQUAL(B2I(ss[2]), 2);
- BOOST_CHECK_EQUAL(B2I(ss[3]), 0xff);
-}
-
BOOST_AUTO_TEST_CASE(class_methods)
{
int intval(100);
diff --git a/src/test/streams_tests.cpp b/src/test/streams_tests.cpp
index 6a69fe9840..0925e2e9ee 100644
--- a/src/test/streams_tests.cpp
+++ b/src/test/streams_tests.cpp
@@ -8,6 +8,8 @@
#include <boost/test/unit_test.hpp>
+using namespace std::string_literals;
+
BOOST_FIXTURE_TEST_SUITE(streams_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(streams_vector_writer)
@@ -162,46 +164,35 @@ BOOST_AUTO_TEST_CASE(bitstream_reader_writer)
BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
{
std::vector<std::byte> in;
- std::vector<char> expected_xor;
- CDataStream ds(in, 0, 0);
// Degenerate case
- ds.Xor({0x00, 0x00});
- BOOST_CHECK_EQUAL(
- std::string(expected_xor.begin(), expected_xor.end()),
- ds.str());
+ {
+ CDataStream ds{in, 0, 0};
+ ds.Xor({0x00, 0x00});
+ BOOST_CHECK_EQUAL(""s, ds.str());
+ }
in.push_back(std::byte{0x0f});
in.push_back(std::byte{0xf0});
- expected_xor.push_back('\xf0');
- expected_xor.push_back('\x0f');
// Single character key
-
- ds.clear();
- ds.insert(ds.begin(), in.begin(), in.end());
-
- ds.Xor({0xff});
- BOOST_CHECK_EQUAL(
- std::string(expected_xor.begin(), expected_xor.end()),
- ds.str());
+ {
+ CDataStream ds{in, 0, 0};
+ ds.Xor({0xff});
+ BOOST_CHECK_EQUAL("\xf0\x0f"s, ds.str());
+ }
// Multi character key
in.clear();
- expected_xor.clear();
in.push_back(std::byte{0xf0});
in.push_back(std::byte{0x0f});
- expected_xor.push_back('\x0f');
- expected_xor.push_back('\x00');
-
- ds.clear();
- ds.insert(ds.begin(), in.begin(), in.end());
- ds.Xor({0xff, 0x0f});
- BOOST_CHECK_EQUAL(
- std::string(expected_xor.begin(), expected_xor.end()),
- ds.str());
+ {
+ CDataStream ds{in, 0, 0};
+ ds.Xor({0xff, 0x0f});
+ BOOST_CHECK_EQUAL("\x0f\x00"s, ds.str());
+ }
}
BOOST_AUTO_TEST_CASE(streams_buffered_file)
diff --git a/src/util/strencodings.cpp b/src/util/strencodings.cpp
index a18eeba563..940fa90da2 100644
--- a/src/util/strencodings.cpp
+++ b/src/util/strencodings.cpp
@@ -328,6 +328,7 @@ bool ParseUInt64(const std::string& str, uint64_t* out)
std::string FormatParagraph(const std::string& in, size_t width, size_t indent)
{
+ assert(width >= indent);
std::stringstream out;
size_t ptr = 0;
size_t indented = 0;
diff --git a/src/util/system.cpp b/src/util/system.cpp
index 4ead39dd6c..64d8ef38f0 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -245,19 +245,6 @@ static std::optional<util::SettingsValue> InterpretValue(const KeyInfo& key, con
return value;
}
-namespace {
-fs::path StripRedundantLastElementsOfPath(const fs::path& path)
-{
- auto result = path;
- while (result.filename().empty() || fs::PathToString(result.filename()) == ".") {
- result = result.parent_path();
- }
-
- assert(fs::equivalent(result, path.lexically_normal()));
- return result;
-}
-} // namespace
-
// Define default constructor and destructor that are not inline, so code instantiating this class doesn't need to
// #include class definitions for all members.
// For example, m_settings has an internal dependency on univalue.
@@ -399,6 +386,13 @@ std::optional<unsigned int> ArgsManager::GetArgFlags(const std::string& name) co
return std::nullopt;
}
+fs::path ArgsManager::GetPathArg(std::string pathlike_arg) const
+{
+ auto result = fs::PathFromString(GetArg(pathlike_arg, "")).lexically_normal();
+ // Remove trailing slash, if present.
+ return result.has_filename() ? result : result.parent_path();
+}
+
const fs::path& ArgsManager::GetBlocksDirPath() const
{
LOCK(cs_args);
@@ -409,7 +403,7 @@ const fs::path& ArgsManager::GetBlocksDirPath() const
if (!path.empty()) return path;
if (IsArgSet("-blocksdir")) {
- path = fs::absolute(fs::PathFromString(GetArg("-blocksdir", "")));
+ path = fs::absolute(GetPathArg("-blocksdir"));
if (!fs::is_directory(path)) {
path = "";
return path;
@@ -433,9 +427,9 @@ const fs::path& ArgsManager::GetDataDir(bool net_specific) const
// this function
if (!path.empty()) return path;
- std::string datadir = GetArg("-datadir", "");
+ const fs::path datadir{GetPathArg("-datadir")};
if (!datadir.empty()) {
- path = fs::absolute(StripRedundantLastElementsOfPath(fs::PathFromString(datadir)));
+ path = fs::absolute(datadir);
if (!fs::is_directory(path)) {
path = "";
return path;
@@ -455,7 +449,6 @@ const fs::path& ArgsManager::GetDataDir(bool net_specific) const
}
}
- path = StripRedundantLastElementsOfPath(path);
return path;
}
@@ -816,8 +809,8 @@ fs::path GetDefaultDataDir()
bool CheckDataDirOption()
{
- std::string datadir = gArgs.GetArg("-datadir", "");
- return datadir.empty() || fs::is_directory(fs::absolute(fs::PathFromString(datadir)));
+ const fs::path datadir{gArgs.GetPathArg("-datadir")};
+ return datadir.empty() || fs::is_directory(fs::absolute(datadir));
}
fs::path GetConfigFile(const std::string& confPath)
diff --git a/src/util/system.h b/src/util/system.h
index a8fd21fcaa..6b7bd38cc2 100644
--- a/src/util/system.h
+++ b/src/util/system.h
@@ -265,6 +265,16 @@ protected:
std::optional<const Command> GetCommand() const;
/**
+ * Get a normalized path from a specified pathlike argument
+ *
+ * It is guaranteed that the returned path has no trailing slashes.
+ *
+ * @param pathlike_arg Pathlike argument to get a path from (e.g., "-datadir", "-blocksdir" or "-walletdir")
+ * @return Normalized path which is get from a specified pathlike argument
+ */
+ fs::path GetPathArg(std::string pathlike_arg) const;
+
+ /**
* Get blocks directory path
*
* @return Blocks path which is network specific
diff --git a/src/wallet/load.cpp b/src/wallet/load.cpp
index 6a74f2eb84..633d8c5450 100644
--- a/src/wallet/load.cpp
+++ b/src/wallet/load.cpp
@@ -28,7 +28,7 @@ bool VerifyWallets(WalletContext& context)
ArgsManager& args = *Assert(context.args);
if (args.IsArgSet("-walletdir")) {
- fs::path wallet_dir = fs::PathFromString(args.GetArg("-walletdir", ""));
+ const fs::path wallet_dir{args.GetPathArg("-walletdir")};
std::error_code error;
// The canonical path cleans the path, preventing >1 Berkeley environment instances for the same directory
// It also lets the fs::exists and fs::is_directory checks below pass on windows, since they return false
diff --git a/src/wallet/test/init_tests.cpp b/src/wallet/test/init_tests.cpp
index c1cae5c5f6..7fdecc5642 100644
--- a/src/wallet/test/init_tests.cpp
+++ b/src/wallet/test/init_tests.cpp
@@ -18,7 +18,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_default)
SetWalletDir(m_walletdir_path_cases["default"]);
bool result = m_wallet_loader->verify();
BOOST_CHECK(result == true);
- fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
+ fs::path walletdir = gArgs.GetPathArg("-walletdir");
fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
BOOST_CHECK_EQUAL(walletdir, expected_path);
}
@@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_custom)
SetWalletDir(m_walletdir_path_cases["custom"]);
bool result = m_wallet_loader->verify();
BOOST_CHECK(result == true);
- fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
+ fs::path walletdir = gArgs.GetPathArg("-walletdir");
fs::path expected_path = fs::canonical(m_walletdir_path_cases["custom"]);
BOOST_CHECK_EQUAL(walletdir, expected_path);
}
@@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing)
SetWalletDir(m_walletdir_path_cases["trailing"]);
bool result = m_wallet_loader->verify();
BOOST_CHECK(result == true);
- fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
+ fs::path walletdir = gArgs.GetPathArg("-walletdir");
fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
BOOST_CHECK_EQUAL(walletdir, expected_path);
}
@@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing2)
SetWalletDir(m_walletdir_path_cases["trailing2"]);
bool result = m_wallet_loader->verify();
BOOST_CHECK(result == true);
- fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
+ fs::path walletdir = gArgs.GetPathArg("-walletdir");
fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
BOOST_CHECK_EQUAL(walletdir, expected_path);
}
diff --git a/src/wallet/walletutil.cpp b/src/wallet/walletutil.cpp
index ce276451c3..df1b10a634 100644
--- a/src/wallet/walletutil.cpp
+++ b/src/wallet/walletutil.cpp
@@ -13,7 +13,7 @@ fs::path GetWalletDir()
fs::path path;
if (gArgs.IsArgSet("-walletdir")) {
- path = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
+ path = gArgs.GetPathArg("-walletdir");
if (!fs::is_directory(path)) {
// If the path specified doesn't exist, we return the deliberately
// invalid empty string.
diff --git a/test/sanitizer_suppressions/ubsan b/test/sanitizer_suppressions/ubsan
index 025bfc1ac0..2084e02b8a 100644
--- a/test/sanitizer_suppressions/ubsan
+++ b/test/sanitizer_suppressions/ubsan
@@ -43,7 +43,6 @@ shift-base:test/fuzz/crypto_diff_fuzz_chacha20.cpp
# contains files in which we expect unsigned integer overflows to occur. The
# list is used to suppress -fsanitize=integer warnings when running our CI UBSan
# job.
-unsigned-integer-overflow:addrman.cpp
unsigned-integer-overflow:arith_uint256.h
unsigned-integer-overflow:common/bloom.cpp
unsigned-integer-overflow:coins.cpp
@@ -57,7 +56,6 @@ unsigned-integer-overflow:pubkey.h
unsigned-integer-overflow:script/interpreter.cpp
unsigned-integer-overflow:txmempool.cpp
unsigned-integer-overflow:util/strencodings.cpp
-implicit-integer-sign-change:addrman.h
implicit-integer-sign-change:bech32.cpp
implicit-integer-sign-change:compat/stdin.cpp
implicit-integer-sign-change:compressor.h
@@ -70,7 +68,6 @@ implicit-integer-sign-change:script/interpreter.cpp
implicit-integer-sign-change:serialize.h
implicit-integer-sign-change:txmempool.cpp
implicit-signed-integer-truncation:addrman.cpp
-implicit-signed-integer-truncation:addrman.h
implicit-signed-integer-truncation:crypto/
implicit-unsigned-integer-truncation:crypto/
shift-base:arith_uint256.cpp