Skip to content

Commit faa630a

Browse files
author
MarcoFalke
committed
test: Fix sanitizer suppresions in streams_tests
1 parent d4e92d8 commit faa630a

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

src/test/streams_tests.cpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,10 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
162162
{
163163
std::vector<std::byte> in;
164164
std::vector<char> expected_xor;
165-
std::vector<unsigned char> key;
166165
CDataStream ds(in, 0, 0);
167166

168167
// Degenerate case
169-
170-
key.push_back('\x00');
171-
key.push_back('\x00');
172-
ds.Xor(key);
168+
ds.Xor({0x00, 0x00});
173169
BOOST_CHECK_EQUAL(
174170
std::string(expected_xor.begin(), expected_xor.end()),
175171
ds.str());
@@ -183,10 +179,8 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
183179

184180
ds.clear();
185181
ds.insert(ds.begin(), in.begin(), in.end());
186-
key.clear();
187182

188-
key.push_back('\xff');
189-
ds.Xor(key);
183+
ds.Xor({0xff});
190184
BOOST_CHECK_EQUAL(
191185
std::string(expected_xor.begin(), expected_xor.end()),
192186
ds.str());
@@ -203,11 +197,7 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
203197
ds.clear();
204198
ds.insert(ds.begin(), in.begin(), in.end());
205199

206-
key.clear();
207-
key.push_back('\xff');
208-
key.push_back('\x0f');
209-
210-
ds.Xor(key);
200+
ds.Xor({0xff, 0x0f});
211201
BOOST_CHECK_EQUAL(
212202
std::string(expected_xor.begin(), expected_xor.end()),
213203
ds.str());
@@ -421,7 +411,7 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file_rand)
421411
size_t find = currentPos + InsecureRandRange(8);
422412
if (find >= fileSize)
423413
find = fileSize - 1;
424-
bf.FindByte(static_cast<char>(find));
414+
bf.FindByte(uint8_t(find));
425415
// The value at each offset is the offset.
426416
BOOST_CHECK_EQUAL(bf.GetPos(), find);
427417
currentPos = find;

test/sanitizer_suppressions/ubsan

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ implicit-integer-sign-change:prevector.h
7777
implicit-integer-sign-change:script/bitcoinconsensus.cpp
7878
implicit-integer-sign-change:script/interpreter.cpp
7979
implicit-integer-sign-change:serialize.h
80-
implicit-integer-sign-change:test/streams_tests.cpp
8180
implicit-integer-sign-change:txmempool.cpp
8281
implicit-integer-sign-change:zmq/zmqpublishnotifier.cpp
8382
implicit-signed-integer-truncation,implicit-integer-sign-change:chain.h

0 commit comments

Comments
 (0)