engine: soundlib: fix buffer overflow with truncated WAV files containing CoolEdit cue mark
This commit is contained in:
parent
4c569e1d5f
commit
2a6862ceb9
1 changed files with 2 additions and 2 deletions
|
@ -241,14 +241,14 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesi
|
||||||
// get cue chunk
|
// get cue chunk
|
||||||
FindChunk( name, "cue " );
|
FindChunk( name, "cue " );
|
||||||
|
|
||||||
if( iff_dataPtr )
|
if( iff_dataPtr && iff_end - iff_dataPtr >= 36 )
|
||||||
{
|
{
|
||||||
iff_dataPtr += 32;
|
iff_dataPtr += 32;
|
||||||
sound.loopstart = GetLittleLong();
|
sound.loopstart = GetLittleLong();
|
||||||
SetBits( sound.flags, SOUND_LOOPED );
|
SetBits( sound.flags, SOUND_LOOPED );
|
||||||
FindNextChunk( name, "LIST" ); // if the next chunk is a LIST chunk, look for a cue length marker
|
FindNextChunk( name, "LIST" ); // if the next chunk is a LIST chunk, look for a cue length marker
|
||||||
|
|
||||||
if( iff_dataPtr )
|
if( iff_dataPtr && iff_end - iff_dataPtr >= 32 )
|
||||||
{
|
{
|
||||||
if( IsFourCC( iff_dataPtr + 28, "mark" ))
|
if( IsFourCC( iff_dataPtr + 28, "mark" ))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue