fix buffer overrun in vorbis decoder
[xonotic/darkplaces.git] / snd_ogg.c
index 1b4b148..9016656 100644 (file)
--- a/snd_ogg.c
+++ b/snd_ogg.c
@@ -546,6 +546,8 @@ static const snd_buffer_t* OGG_FetchSound (channel_t* ch, unsigned int* start, u
                return NULL;
        }
        newlength = per_sfx->format.speed * factor;  // -> 1 sec of sound before resampling
+       if(newlength > sizeof(resampling_buffer))
+               newlength = sizeof(resampling_buffer);
 
        // Decompress in the resampling_buffer
 #if BYTE_ORDER == BIG_ENDIAN