Check for EOF to fix an infinite loop while parsing fuzzed MPC files.

This commit is contained in:
Tsuda Kageyu
2015-01-08 12:28:20 +09:00
parent 2193d6dd84
commit 65664e6855
3 changed files with 13 additions and 2 deletions

BIN
tests/data/infloop.mpc Normal file

Binary file not shown.

View File

@ -18,6 +18,7 @@ class TestMPC : public CppUnit::TestFixture
CPPUNIT_TEST(testPropertiesSV5);
CPPUNIT_TEST(testPropertiesSV4);
CPPUNIT_TEST(testFuzzedFile1);
CPPUNIT_TEST(testFuzzedFile2);
CPPUNIT_TEST_SUITE_END();
public:
@ -68,6 +69,12 @@ public:
CPPUNIT_ASSERT(f.isValid());
}
void testFuzzedFile2()
{
MPC::File f(TEST_FILE_PATH_C("infloop.mpc"));
CPPUNIT_ASSERT(f.isValid());
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(TestMPC);