From 768dc56ac02b38c44e0422368ca8c90f9291a877 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Sun, 2 Jun 2019 18:07:08 +0200 Subject: [PATCH] - Fixed a buffer overflow with Timidity++ when playing Sigil e5m5 music. See https://forum.zdoom.org/viewtopic.php?f=2&t=64910 . --- src/sound/timiditypp/resample.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sound/timiditypp/resample.cpp b/src/sound/timiditypp/resample.cpp index 7e47389a5..f37583ede 100644 --- a/src/sound/timiditypp/resample.cpp +++ b/src/sound/timiditypp/resample.cpp @@ -935,7 +935,8 @@ void pre_resample(Sample * sp) return; } - dest = newdata = (sample_t *)safe_malloc((int32_t)(newlen >> (FRACTION_BITS - 1)) + 2); + // [EP] Fix the bad allocation count. + dest = newdata = (sample_t *)safe_malloc(((int32_t)(newlen >> (FRACTION_BITS - 1)) + 2)*sizeof(sample_t)); dest[newlen >> FRACTION_BITS] = 0; *dest++ = src[0];