Skip to content
Snippets Groups Projects
Commit 7369de39 authored by Jari Vetoniemi's avatar Jari Vetoniemi
Browse files

Test mem_release with garbage input

parent 77cf92aa
No related branches found
No related tags found
No related merge requests found
......@@ -177,9 +177,30 @@ static bool test_OneofMessage()
return true;
}
/* Garbage input */
static bool test_Garbage()
{
const uint8_t buffer[] = "I'm only happy when it rains";
const size_t msgsize = sizeof(buffer);
{
OneofMessage msg = OneofMessage_init_zero;
pb_istream_t stream = pb_istream_from_buffer(buffer, msgsize);
TEST(!pb_decode(&stream, OneofMessage_fields, &msg));
}
{
TestMessage msg = TestMessage_init_zero;
pb_istream_t stream = pb_istream_from_buffer(buffer, msgsize);
TEST(!pb_decode(&stream, TestMessage_fields, &msg));
}
return true;
}
int main()
{
if (test_TestMessage() && test_OneofMessage())
if (test_TestMessage() && test_OneofMessage() && test_Garbage())
return 0;
else
return 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment