diff --git a/engine/common/soundlib/snd_wav.c b/engine/common/soundlib/snd_wav.c index 07bc8082..91294304 100644 --- a/engine/common/soundlib/snd_wav.c +++ b/engine/common/soundlib/snd_wav.c @@ -241,14 +241,14 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesi // get cue chunk FindChunk( name, "cue " ); - if( iff_dataPtr ) + if( iff_dataPtr && iff_end - iff_dataPtr >= 36 ) { iff_dataPtr += 32; sound.loopstart = GetLittleLong(); SetBits( sound.flags, SOUND_LOOPED ); 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" )) {