void RIFF::WAV::Properties::read(const ByteVector &data)
{
+ if(data.size() < 16) {
+ debug("RIFF::WAV::Properties::read() - \"fmt \" chunk is too short for WAV.");
+ return;
+ }
+
d->format = data.toShort(0, false);
d->channels = data.toShort(2, false);
d->sampleRate = data.toUInt(4, false);
void testFuzzedFiles()
{
- RIFF::WAV::File f(TEST_FILE_PATH_C("infloop.wav"));
- CPPUNIT_ASSERT(!f.isValid());
+ RIFF::WAV::File f1(TEST_FILE_PATH_C("infloop.wav"));
+ CPPUNIT_ASSERT(!f1.isValid());
+
+ RIFF::WAV::File f2(TEST_FILE_PATH_C("segfault.wav"));
+ CPPUNIT_ASSERT(f2.isValid());
}
};