diff options
author | Johannes Schickel | 2010-03-20 20:25:37 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-03-20 20:25:37 +0000 |
commit | 01f56108363514812860abe2620e677a1f30b7ec (patch) | |
tree | 03e2905bebc0340c0ca5fdde29553c58408a5af7 | |
parent | a8d2c0de100ed132e0376c9a337a45d1bc7a0c69 (diff) | |
download | scummvm-rg350-01f56108363514812860abe2620e677a1f30b7ec.tar.gz scummvm-rg350-01f56108363514812860abe2620e677a1f30b7ec.tar.bz2 scummvm-rg350-01f56108363514812860abe2620e677a1f30b7ec.zip |
Fix out of bounds access.
svn-id: r48338
-rw-r--r-- | engines/kyra/sound.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp index f25a4833a2..3ef6645d55 100644 --- a/engines/kyra/sound.cpp +++ b/engines/kyra/sound.cpp @@ -112,8 +112,9 @@ Audio::SeekableAudioStream *Sound::getVoiceStream(const char *file) { bool Sound::playVoiceStream(Audio::AudioStream *stream, Audio::SoundHandle *handle, uint8 volume, bool isSfx) { int h = 0; - while (_mixer->isSoundHandleActive(_soundChannels[h]) && h < kNumChannelHandles) - h++; + while (h < kNumChannelHandles && _mixer->isSoundHandleActive(_soundChannels[h])) + ++h; + if (h >= kNumChannelHandles) return false; @@ -126,7 +127,7 @@ bool Sound::playVoiceStream(Audio::AudioStream *stream, Audio::SoundHandle *hand void Sound::voiceStop(const Audio::SoundHandle *handle) { if (!handle) { - for (int h = 0; h < kNumChannelHandles; h++) { + for (int h = 0; h < kNumChannelHandles; ++h) { if (_mixer->isSoundHandleActive(_soundChannels[h])) _mixer->stopHandle(_soundChannels[h]); } @@ -137,7 +138,7 @@ void Sound::voiceStop(const Audio::SoundHandle *handle) { bool Sound::voiceIsPlaying(const Audio::SoundHandle *handle) { if (!handle) { - for (int h = 0; h < kNumChannelHandles; h++) { + for (int h = 0; h < kNumChannelHandles; ++h) { if (_mixer->isSoundHandleActive(_soundChannels[h])) return true; } |