From 7badb035c3f8d63022c72c82f54473b59158a0a7 Mon Sep 17 00:00:00 2001 From: molivier Date: Tue, 20 Jan 2004 13:18:49 +0000 Subject: [PATCH] Added a check in the WAV loading code to make sure the file is a WAV file before proceeding. Thanks to Urre for pointing out this bug. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3817 d7cf8633-e32d-0410-b094-e92efae38249 --- snd_mem.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snd_mem.c b/snd_mem.c index 81b0db15..4e9f5cb5 100644 --- a/snd_mem.c +++ b/snd_mem.c @@ -225,6 +225,10 @@ sfxcache_t *S_LoadWavFile (const char *filename, sfx_t *s) if (!data) return NULL; + // Don't try to load it if it's not a WAV file + if (memcmp (data, "RIFF", 4) || memcmp (data + 8, "WAVE", 4)) + return NULL; + info = GetWavinfo (s->name, data, fs_filesize); // Stereo sounds are allowed (intended for music) if (info.channels < 1 || info.channels > 2) -- 2.39.2