From 869b9c9ccc8f3a2183552e9ddf6d83768177c40c Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 2 Jan 2011 18:11:48 +0000 Subject: [PATCH] - Fixed: FMODSoundRenderer::DrawWaveDebug() only allocated enough space for the wavearray based on the window_size, so for large numbers of output channels, it would not allocate enough space for the spectrum data (which is definied by SPECTRUM_SIZE, not the window_size) and write junk on the stack when drawing the spectrums, causing a crash. SVN r3087 (trunk) --- src/sound/fmodsound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index 399322061..182ba488d 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -2555,7 +2555,7 @@ void FMODSoundRenderer::DrawWaveDebug(int mode) // 16 pixels of padding between each window. window_size = (screen->GetWidth() - 16) / numoutchans - 16; - float *wavearray = (float*)alloca(window_size*sizeof(float)); + float *wavearray = (float*)alloca(MAX(SPECTRUM_SIZE,window_size)*sizeof(float)); y = 16; y = DrawChannelGroupOutput(SfxGroup, wavearray, window_size, window_height, y, mode);