aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorEugene Sandulenko2016-05-31 13:10:35 +0200
committerEugene Sandulenko2016-05-31 17:12:18 +0200
commit8e0447e9262aada3bc0753b3ce1707dccf3949ab (patch)
tree8d44673fe1b8644fc3520cd0c7771ba4cae45b8a /audio
parent523c0ac0aaa8605ea23c44da4e1d796e0a7f8240 (diff)
downloadscummvm-rg350-8e0447e9262aada3bc0753b3ce1707dccf3949ab.tar.gz
scummvm-rg350-8e0447e9262aada3bc0753b3ce1707dccf3949ab.tar.bz2
scummvm-rg350-8e0447e9262aada3bc0753b3ce1707dccf3949ab.zip
AUDIO: Fix memory corruption.
Since it was --voice, we were reading element index -1.
Diffstat (limited to 'audio')
-rw-r--r--audio/mods/maxtrax.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/audio/mods/maxtrax.cpp b/audio/mods/maxtrax.cpp
index f5754a5f96..b0cdaef95a 100644
--- a/audio/mods/maxtrax.cpp
+++ b/audio/mods/maxtrax.cpp
@@ -708,7 +708,7 @@ int8 MaxTrax::noteOn(ChannelContext &channel, const byte note, uint16 volume, ui
voiceNum = pickvoice((channel.flags & ChannelContext::kFlagRightChannel) != 0 ? 1 : 0, pri);
} else {
VoiceContext *voice = ARRAYEND(_voiceCtx);
- for (voiceNum = ARRAYSIZE(_voiceCtx); voiceNum-- != 0 && --voice->channel != &channel;)
+ for (voiceNum = ARRAYSIZE(_voiceCtx); voiceNum >= 0 && voice->channel != &channel; voiceNum--, voice--)
;
if (voiceNum < 0)
voiceNum = pickvoice((channel.flags & ChannelContext::kFlagRightChannel) != 0 ? 1 : 0, pri);