- Fixed a buffer overflow with Timidity++ when playing Sigil e5m5 music.

See https://forum.zdoom.org/viewtopic.php?f=2&t=64910 .
This commit is contained in:
Edoardo Prezioso 2019-06-02 18:07:08 +02:00 committed by Christoph Oelckers
parent 9f99d1b2cc
commit 74e69567ef

View file

@ -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];