From b086ec276edcc4f540764d27421a52d05263e304 Mon Sep 17 00:00:00 2001 From: havoc Date: Thu, 3 Mar 2011 15:56:55 +0000 Subject: [PATCH] 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 --- snd_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.39.2