mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-05-01 23:31:03 +02:00
Merge pull request #375 from whoshuu/test-parse-error
Write test case for parse error when unpacking unused 0xc1
This commit is contained in:
commit
d23a649427
@ -372,3 +372,22 @@ TEST(unpack, insufficient_bytes_zone)
|
||||
EXPECT_EQ(off, 0u);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(unpack, parse_error)
|
||||
{
|
||||
msgpack::sbuffer sbuf;
|
||||
|
||||
char c = '\xc1';
|
||||
sbuf.write(&c, 1);
|
||||
|
||||
bool thrown = false;
|
||||
msgpack::unpacked msg;
|
||||
try {
|
||||
msgpack::unpack(msg, sbuf.data(), sbuf.size());
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
catch (msgpack::parse_error const&) {
|
||||
thrown = true;
|
||||
}
|
||||
EXPECT_TRUE(thrown);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user