mirror of
https://github.com/monero-project/monero.git
synced 2026-04-28 11:53:17 -07:00
Improve unpack reserve handling
This commit is contained in:
committed by
Lee *!* Clagett
parent
b9998fc9e1
commit
baa631ff75
@@ -372,6 +372,20 @@ TEST(Serialization, serializes_vector_int64_as_fixed_int)
|
||||
ASSERT_EQ(57, blob.size());
|
||||
}
|
||||
|
||||
TEST(Serialization, deserializes_vector_reserve)
|
||||
{
|
||||
std::vector<int64_t> v;
|
||||
string blob;
|
||||
|
||||
tools::write_varint(std::back_inserter(blob), unsigned(100));
|
||||
blob.append(std::string(100, 0));
|
||||
|
||||
ASSERT_LT(v.capacity(), 20);
|
||||
ASSERT_FALSE(serialization::parse_binary(blob, v));
|
||||
ASSERT_LT(v.capacity(), 100); // could fail if lib allocates more in reserve call
|
||||
}
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
template<typename T>
|
||||
|
||||
Reference in New Issue
Block a user