From: molivier Date: Tue, 20 Jan 2004 13:18:49 +0000 (+0000) Subject: Added a check in the WAV loading code to make sure the file is a WAV file before... X-Git-Tag: xonotic-v0.1.0preview~6154 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=7badb035c3f8d63022c72c82f54473b59158a0a7;hp=4418c8f7875bb156eea684b5a52cc76ab52a66db;p=xonotic%2Fdarkplaces.git 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 --- 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)