From: havoc Date: Fri, 19 Nov 2010 15:14:53 +0000 (+0000) Subject: don't load corrupt wav files X-Git-Tag: xonotic-v0.1.0preview~57 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=df2f87da97af1289f4f0d07f36afae6e36a71527;p=xonotic%2Fdarkplaces.git don't load corrupt wav files git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10616 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=debad66a1a7af625005e58a5b7287770d3e50bc6 --- diff --git a/snd_wav.c b/snd_wav.c index 438db2ba..3f1f76e8 100644 --- a/snd_wav.c +++ b/snd_wav.c @@ -84,6 +84,12 @@ static void FindNextChunk(char *name) data_p = NULL; return; } + if (data_p + iff_chunk_len > iff_end) + { + // truncated chunk! + data_p = NULL; + return; + } data_p -= 8; last_chunk = data_p + 8 + ( (iff_chunk_len + 1) & ~1 ); if (!strncmp((const char *)data_p, name, 4))