Changeset View
Changeset View
Standalone View
Standalone View
src/test/blockencodings_tests.cpp
Show First 20 Lines • Show All 449 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(TransactionsRequestDeserializationOverflowTest) { | ||||
WriteCompactSize(stream, req0.indices[2]); | WriteCompactSize(stream, req0.indices[2]); | ||||
BlockTransactionsRequest req1; | BlockTransactionsRequest req1; | ||||
// If MAX_SIZE is the limiting factor, the deserialization should throw. | // If MAX_SIZE is the limiting factor, the deserialization should throw. | ||||
// Otherwise make sure that the overflow edge-case is under control. | // Otherwise make sure that the overflow edge-case is under control. | ||||
BOOST_CHECK_EXCEPTION(stream >> req1, std::ios_base::failure, | BOOST_CHECK_EXCEPTION(stream >> req1, std::ios_base::failure, | ||||
HasReason((MAX_SIZE < req0.indices[1]) | HasReason((MAX_SIZE < req0.indices[1]) | ||||
? "ReadCompactSize(): size too large" | ? "ReadCompactSize(): size too large" | ||||
: "indices overflowed 32 bits")); | : "differential value overflow")); | ||||
} | } | ||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |