]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_mem.c
Added a check in the WAV loading code to make sure the file is a WAV file before...
[xonotic/darkplaces.git] / snd_mem.c
index 81b0db1537fcbdb9d97eb28d2b99a34fedd4f6ff..4e9f5cb53b5080b2451379ecfd4ed6c1699cebe5 100644 (file)
--- 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)