mirror of
https://github.com/monero-project/monero.git
synced 2024-12-22 19:49:30 +00:00
unit_tests: fix use after free in serialization test
This commit is contained in:
parent
8fde011dbe
commit
5eaedb51b9
1 changed files with 4 additions and 2 deletions
|
@ -132,7 +132,8 @@ TEST(Serialization, BinaryArchiveInts) {
|
|||
ASSERT_EQ(8, oss.str().size());
|
||||
ASSERT_EQ(string("\0\0\0\0\xff\0\0\0", 8), oss.str());
|
||||
|
||||
binary_archive<false> iar{epee::strspan<std::uint8_t>(oss.str())};
|
||||
const std::string s = oss.str();
|
||||
binary_archive<false> iar{epee::strspan<std::uint8_t>(s)};
|
||||
iar.serialize_int(x1);
|
||||
ASSERT_EQ(8, iar.getpos());
|
||||
ASSERT_TRUE(iar.good());
|
||||
|
@ -150,7 +151,8 @@ TEST(Serialization, BinaryArchiveVarInts) {
|
|||
ASSERT_EQ(6, oss.str().size());
|
||||
ASSERT_EQ(string("\x80\x80\x80\x80\xF0\x1F", 6), oss.str());
|
||||
|
||||
binary_archive<false> iar{epee::strspan<std::uint8_t>(oss.str())};
|
||||
const std::string s = oss.str();
|
||||
binary_archive<false> iar{epee::strspan<std::uint8_t>(s)};
|
||||
iar.serialize_varint(x1);
|
||||
ASSERT_TRUE(iar.good());
|
||||
ASSERT_EQ(x, x1);
|
||||
|
|
Loading…
Reference in a new issue