mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Fix a segfault when parsing WAV properties.
This commit is contained in:
parent
695fb5ec16
commit
0d2e01df61
@ -115,6 +115,11 @@ TagLib::uint RIFF::WAV::Properties::sampleFrames() const
|
||||
|
||||
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);
|
||||
|
BIN
tests/data/segfault.wav
Normal file
BIN
tests/data/segfault.wav
Normal file
Binary file not shown.
@ -72,8 +72,11 @@ public:
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user