]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
don't load corrupt wav files
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 19 Nov 2010 15:14:53 +0000 (15:14 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 20 Nov 2010 18:06:23 +0000 (19:06 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10616 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=debad66a1a7af625005e58a5b7287770d3e50bc6

snd_wav.c

index 438db2ba8a0a95a189b5ac66f23b883c0496b453..3f1f76e81958a79f621f837e1c8e670aa03bca1c 100644 (file)
--- 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))