[Scummvm-cvs-logs] SF.net SVN: scummvm:[48339] scummvm/branches/branch-1-1-0/engines/kyra/ sound.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat Mar 20 21:32:02 CET 2010


Revision: 48339
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48339&view=rev
Author:   lordhoto
Date:     2010-03-20 20:32:01 +0000 (Sat, 20 Mar 2010)

Log Message:
-----------
Backport of r48338: "Fix out of bounds access."

Modified Paths:
--------------
    scummvm/branches/branch-1-1-0/engines/kyra/sound.cpp

Modified: scummvm/branches/branch-1-1-0/engines/kyra/sound.cpp
===================================================================
--- scummvm/branches/branch-1-1-0/engines/kyra/sound.cpp	2010-03-20 20:25:37 UTC (rev 48338)
+++ scummvm/branches/branch-1-1-0/engines/kyra/sound.cpp	2010-03-20 20:32:01 UTC (rev 48339)
@@ -112,8 +112,9 @@
 
 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 @@
 
 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 @@
 
 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;
 		}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list