From debad66a1a7af625005e58a5b7287770d3e50bc6 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 --- snd_wav.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/snd_wav.c b/snd_wav.c index 7eb118d7..b55c3665 100644 --- a/snd_wav.c +++ b/snd_wav.c @@ -84,6 +84,12 @@ static void FindNextChunk(const 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