adding unit tests and fixing same overflow issue in hpp files

This commit is contained in:
jwang
2018-08-29 16:02:14 -07:00
committed by tbeu
parent b3dfe28be4
commit 60930f4b12
3 changed files with 37 additions and 1 deletions

View File

@@ -1352,3 +1352,16 @@ TEST(MSGPACKC, unpack_array_uint64)
EXPECT_EQ(0xFFF0000000000001LL, obj.via.array.ptr[0].via.u64);
msgpack_zone_destroy(&z);
}
TEST(MSGPACKC, vreff_buffer_overflow)
{
msgpack_vrefbuffer vbuf;
msgpack_vrefbuffer to;
size_t ref_size = 0;
size_t len = 0x1000;
size_t chunk_size = std::numeric_limits<size_t>::max();
char *buf = (char *)malloc(len);
EXPECT_FALSE(msgpack_vrefbuffer_init(&vbuf, ref_size, chunk_size));
EXPECT_EQ(-1, msgpack_vrefbuffer_migrate(&vbuf, &to));
}