From: havoc Date: Thu, 3 Mar 2011 15:56:55 +0000 (+0000) Subject: fix rounding error that caused a memory block overflow in steelstorm when loading... X-Git-Tag: xonotic-v0.5.0~425^2~17 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b086ec276edcc4f540764d27421a52d05263e304;p=xonotic%2Fdarkplaces.git fix rounding error that caused a memory block overflow in steelstorm when loading certain sound files git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10886 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/snd_mem.c b/snd_mem.c index 75f9e829..11b0a9d9 100644 --- a/snd_mem.c +++ b/snd_mem.c @@ -84,7 +84,7 @@ snd_buffer_t *Snd_CreateSndBuffer (const unsigned char *samples, unsigned int sa size_t newsampleframes, memsize; snd_buffer_t* sb; - newsampleframes = (size_t) ((double)sampleframes * (double)sb_speed / (double)in_format->speed); + newsampleframes = (size_t) ceil((double)sampleframes * (double)sb_speed / (double)in_format->speed); memsize = newsampleframes * in_format->channels * in_format->width; memsize += sizeof (*sb) - sizeof (sb->samples);