From df2f87da97af1289f4f0d07f36afae6e36a71527 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 19 Nov 2010 15:14:53 +0000 Subject: [PATCH] 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 --- snd_wav.c | 6 ++++++ 1 file changed, 6 insertions(+) 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)) -- 2.39.2