aboutsummaryrefslogtreecommitdiff
path: root/src/test/streams_tests.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-01-05 15:06:38 +0100
committerMarcoFalke <falke.marco@gmail.com>2019-01-05 15:06:43 +0100
commit88bbcdc4e9b6e745934a34dd3a9f4ec596d2cff7 (patch)
tree8284c9bffdaf70fb5de9754104320a3fa9bfa24f /src/test/streams_tests.cpp
parentfe5a70b9fefa0548f497a749746f53f3d7fd0ebb (diff)
parent4f4993fe2ac25cb2676d35a98e2b22da1add1bb1 (diff)
Merge #14357: streams: Fix broken streams_vector_reader test. Remove unused seek(size_t).
4f4993fe2a Remove UBSan suppression (practicalswift) 958e1a307e streams: Remove unused seek(size_t) (practicalswift) Pull request description: Fix broken `streams_vector_reader` test. Remove unused `seek(size_t)`. Before this change the test `streams_vector_reader` triggered an unintended unsigned integer wraparound. It tried so seek using a negative value in `reader.seek(-6)`. Changes in this PR: * Fix broken `VectorReader::seek(size_t)` test case * Remove unused `seek(size_t)` Tree-SHA512: 6c6affd680626363eef9e496748f2f86a522325abab9d6b13161f41125cdc29ceb36c2c1509c90b8ff108d606df7629e55e094cc2b6253b05a892b81ce176b71
Diffstat (limited to 'src/test/streams_tests.cpp')
-rw-r--r--src/test/streams_tests.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/test/streams_tests.cpp b/src/test/streams_tests.cpp
index 26cf74830d..a1940eb80e 100644
--- a/src/test/streams_tests.cpp
+++ b/src/test/streams_tests.cpp
@@ -102,15 +102,15 @@ BOOST_AUTO_TEST_CASE(streams_vector_reader)
BOOST_CHECK_THROW(reader >> d, std::ios_base::failure);
// Read a 4 bytes as a signed int from the beginning of the buffer.
- reader.seek(-6);
- reader >> d;
+ VectorReader new_reader(SER_NETWORK, INIT_PROTO_VERSION, vch, 0);
+ new_reader >> d;
BOOST_CHECK_EQUAL(d, 67370753); // 1,255,3,4 in little-endian base-256
- BOOST_CHECK_EQUAL(reader.size(), 2);
- BOOST_CHECK(!reader.empty());
+ BOOST_CHECK_EQUAL(new_reader.size(), 2);
+ BOOST_CHECK(!new_reader.empty());
// Reading after end of byte vector throws an error even if the reader is
// not totally empty.
- BOOST_CHECK_THROW(reader >> d, std::ios_base::failure);
+ BOOST_CHECK_THROW(new_reader >> d, std::ios_base::failure);
}
BOOST_AUTO_TEST_CASE(bitstream_reader_writer)