From 0e5587812e7ab69aeb2dcf432c40a6bd1d3c0506 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 23 Aug 2008 02:38:00 +0000 Subject: [PATCH] - Fixed: Timidity::Renderer::reset_voices() must completely zero the voices. Because this wasn't done, note_on() could try to access the sample for a voice that had never been played yet and access random memory. There may be other places where it's a problem, but this is where I noticed it, by chance. SVN r1182 (trunk) --- docs/rh-log.txt | 7 +++++++ src/p_setup.cpp | 4 ++-- src/timidity/playmidi.cpp | 5 +---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 0f562a330..ee22a3f80 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,10 @@ +August 22, 2008 +- Fixed: Timidity::Renderer::reset_voices() must completely zero the + voices. Because this wasn't done, note_on() could try to access + the sample for a voice that had never been played yet and access + random memory. There may be other places where it's a problem, but + this is where I noticed it, by chance. + August 21, 2008 (Changes by Graf Zahl) - Fixed: The conversion of the strings in wbstartstruct_t to FStrings caused crashes when reloading the hub data. diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 10f0da490..227f4c6d3 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -2818,7 +2818,7 @@ static void P_GroupLines (bool buildmap) Printf ("---Group Lines Times---\n"); for (i = 0; i < 7; ++i) { - Printf (" time %d:%9.4f ms\n", i, times[i].Time() * 1e3); + Printf (" time %d:%9.4f ms\n", i, times[i].TimeMS()); } } } @@ -3553,7 +3553,7 @@ void P_SetupLevel (char *lumpname, int position) "init polys", "precache" }; - Printf ("Time%3d:%9.4f ms (%s)\n", i, times[i].Time() * 1e3, timenames[i]); + Printf ("Time%3d:%9.4f ms (%s)\n", i, times[i].TimeMS(), timenames[i]); } } MapThingsConverted.Clear(); diff --git a/src/timidity/playmidi.cpp b/src/timidity/playmidi.cpp index 9c77e7c52..5db4f61bc 100644 --- a/src/timidity/playmidi.cpp +++ b/src/timidity/playmidi.cpp @@ -36,10 +36,7 @@ namespace Timidity void Renderer::reset_voices() { - for (int i = 0; i < voices; i++) - { - voice[i].status = 0; - } + memset(voice, 0, sizeof(voice[0]) * voices); } /* Process the Reset All Controllers event */