mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 23:09:44 -04:00
Merge bitcoin/bitcoin#24190: test: Fix sanitizer suppresions in streams_tests
faa630aa15
test: Fix sanitizer suppresions in streams_tests (MarcoFalke) Pull request description: Two changes (that also make sense on their own) to remove the file-wide sanitizer suppression: * `FindByte` no longer takes a `char`, but an `uint8_t`, after commit196b459920
. * The `key` vector of unsigned chars can be removed and inlined as initializer-list. This avoids a bunch of verbose code like `clear()` and `push_back` of `char`s. ACKs for top commit: PastaPastaPasta: utACKfaa630aa15
, I have reviewed the changes and agree it makes sense to merge Tree-SHA512: 747b9d4676fad6d07f3955668639c93333625e69199ff4c499f01167de3875990d93db85e775a7f5b1b684575dceaec8aa000b4db15525fc47b699bac1c85e3d
This commit is contained in:
commit
fcac16fff8
2 changed files with 4 additions and 15 deletions
|
@ -162,14 +162,10 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
|
||||||
{
|
{
|
||||||
std::vector<std::byte> in;
|
std::vector<std::byte> in;
|
||||||
std::vector<char> expected_xor;
|
std::vector<char> expected_xor;
|
||||||
std::vector<unsigned char> key;
|
|
||||||
CDataStream ds(in, 0, 0);
|
CDataStream ds(in, 0, 0);
|
||||||
|
|
||||||
// Degenerate case
|
// Degenerate case
|
||||||
|
ds.Xor({0x00, 0x00});
|
||||||
key.push_back('\x00');
|
|
||||||
key.push_back('\x00');
|
|
||||||
ds.Xor(key);
|
|
||||||
BOOST_CHECK_EQUAL(
|
BOOST_CHECK_EQUAL(
|
||||||
std::string(expected_xor.begin(), expected_xor.end()),
|
std::string(expected_xor.begin(), expected_xor.end()),
|
||||||
ds.str());
|
ds.str());
|
||||||
|
@ -183,10 +179,8 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
|
||||||
|
|
||||||
ds.clear();
|
ds.clear();
|
||||||
ds.insert(ds.begin(), in.begin(), in.end());
|
ds.insert(ds.begin(), in.begin(), in.end());
|
||||||
key.clear();
|
|
||||||
|
|
||||||
key.push_back('\xff');
|
ds.Xor({0xff});
|
||||||
ds.Xor(key);
|
|
||||||
BOOST_CHECK_EQUAL(
|
BOOST_CHECK_EQUAL(
|
||||||
std::string(expected_xor.begin(), expected_xor.end()),
|
std::string(expected_xor.begin(), expected_xor.end()),
|
||||||
ds.str());
|
ds.str());
|
||||||
|
@ -203,11 +197,7 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
|
||||||
ds.clear();
|
ds.clear();
|
||||||
ds.insert(ds.begin(), in.begin(), in.end());
|
ds.insert(ds.begin(), in.begin(), in.end());
|
||||||
|
|
||||||
key.clear();
|
ds.Xor({0xff, 0x0f});
|
||||||
key.push_back('\xff');
|
|
||||||
key.push_back('\x0f');
|
|
||||||
|
|
||||||
ds.Xor(key);
|
|
||||||
BOOST_CHECK_EQUAL(
|
BOOST_CHECK_EQUAL(
|
||||||
std::string(expected_xor.begin(), expected_xor.end()),
|
std::string(expected_xor.begin(), expected_xor.end()),
|
||||||
ds.str());
|
ds.str());
|
||||||
|
@ -421,7 +411,7 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file_rand)
|
||||||
size_t find = currentPos + InsecureRandRange(8);
|
size_t find = currentPos + InsecureRandRange(8);
|
||||||
if (find >= fileSize)
|
if (find >= fileSize)
|
||||||
find = fileSize - 1;
|
find = fileSize - 1;
|
||||||
bf.FindByte(static_cast<char>(find));
|
bf.FindByte(uint8_t(find));
|
||||||
// The value at each offset is the offset.
|
// The value at each offset is the offset.
|
||||||
BOOST_CHECK_EQUAL(bf.GetPos(), find);
|
BOOST_CHECK_EQUAL(bf.GetPos(), find);
|
||||||
currentPos = find;
|
currentPos = find;
|
||||||
|
|
|
@ -71,7 +71,6 @@ implicit-integer-sign-change:prevector.h
|
||||||
implicit-integer-sign-change:script/bitcoinconsensus.cpp
|
implicit-integer-sign-change:script/bitcoinconsensus.cpp
|
||||||
implicit-integer-sign-change:script/interpreter.cpp
|
implicit-integer-sign-change:script/interpreter.cpp
|
||||||
implicit-integer-sign-change:serialize.h
|
implicit-integer-sign-change:serialize.h
|
||||||
implicit-integer-sign-change:test/streams_tests.cpp
|
|
||||||
implicit-integer-sign-change:txmempool.cpp
|
implicit-integer-sign-change:txmempool.cpp
|
||||||
implicit-integer-sign-change:zmq/zmqpublishnotifier.cpp
|
implicit-integer-sign-change:zmq/zmqpublishnotifier.cpp
|
||||||
implicit-signed-integer-truncation:addrman.cpp
|
implicit-signed-integer-truncation:addrman.cpp
|
||||||
|
|
Loading…
Add table
Reference in a new issue