Check the packet size to fix a segfault error while parsing fuzzed MPC files.

This commit is contained in:
Tsuda Kageyu
2015-01-08 12:49:33 +09:00
parent 65664e6855
commit 829ae2112a
3 changed files with 28 additions and 0 deletions

BIN
tests/data/segfault.mpc Normal file

Binary file not shown.

View File

@ -19,6 +19,7 @@ class TestMPC : public CppUnit::TestFixture
CPPUNIT_TEST(testPropertiesSV4);
CPPUNIT_TEST(testFuzzedFile1);
CPPUNIT_TEST(testFuzzedFile2);
CPPUNIT_TEST(testFuzzedFile3);
CPPUNIT_TEST_SUITE_END();
public:
@ -75,6 +76,12 @@ public:
CPPUNIT_ASSERT(f.isValid());
}
void testFuzzedFile3()
{
MPC::File f(TEST_FILE_PATH_C("segfault.mpc"));
CPPUNIT_ASSERT(f.isValid());
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(TestMPC);