From 74e69567efbb6396c2e7c9a663236d4d27d0b7b5 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 06b531fc9..9df494344 100644 --- a/src/sound/timiditypp/resample.cpp +++ b/src/sound/timiditypp/resample.cpp @@ -933,7 +933,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];