Fixed potential buffer overflow in SoundFileReaderWav

This commit is contained in:
Laurent Gomila 2015-03-15 14:44:16 +01:00
parent 9d3024e13e
commit 81a8e4e4ca

View File

@ -232,8 +232,7 @@ bool SoundFileReaderWav::parseHeader(Info& info)
// Skip potential extra information (should not exist for PCM) // Skip potential extra information (should not exist for PCM)
if (subChunkSize > 16) if (subChunkSize > 16)
{ {
char buffer[1024]; if (m_stream->seek(m_stream->tell() + subChunkSize - 16) == -1)
if (m_stream->read(buffer, subChunkSize - 16) != subChunkSize - 16)
return false; return false;
} }
} }
@ -252,8 +251,7 @@ bool SoundFileReaderWav::parseHeader(Info& info)
else else
{ {
// unknown chunk, skip it // unknown chunk, skip it
char buffer[1024]; if (m_stream->seek(m_stream->tell() + subChunkSize) == -1)
if (m_stream->read(buffer, subChunkSize) != subChunkSize)
return false; return false;
} }
} }