[Scummvm-cvs-logs] CVS: scummvm/queen music.cpp,1.25,1.26
Gregory Montoir
cyx at users.sourceforge.net
Mon Dec 20 04:41:15 CET 2004
Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3370/queen
Modified Files:
music.cpp
Log Message:
Added check to prevent queueing invalid songs, and thus reading OOB...
Index: music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/music.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- music.cpp 23 Nov 2004 22:21:32 -0000 1.25
+++ music.cpp 20 Dec 2004 12:39:54 -0000 1.26
@@ -80,6 +80,13 @@
}
bool MusicPlayer::queueSong(uint16 songNum) {
+ if (songNum >= _numSongs) {
+ // this happens at the end of the car chase, where we try to play song 176,
+ // see Sound::_tune[], entry 39
+ warning("Trying to queue an invalid song number %d, max %d", songNum, _numSongs);
+ return false;
+ }
+
uint8 emptySlots = 0;
for (int i = 0; i < MUSIC_QUEUE_SIZE; i++)
if (!_songQueue[i])
@@ -257,7 +264,7 @@
if (!songNum) {
stopMusic();
return;
- }
+ }
byte *musicPtr = _musicData + songOffset(songNum);
uint32 size = songLength(songNum);
More information about the Scummvm-git-logs
mailing list