mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 22:58:09 +00:00
KYRA: (LOL) - fix invalid use after free
It's possible for `snd_loadSoundFile` to be called with a negative track number (e.g. -1).
This commit is contained in:
parent
704ed4e3b7
commit
cfb9bfc8c9
@ -249,7 +249,7 @@ void LoLEngine::snd_loadSoundFile(int track) {
|
||||
if (_sound->musicEnabled()) {
|
||||
if (_flags.platform == Common::kPlatformDOS) {
|
||||
int t = (track - 250) * 3;
|
||||
if (_curMusicFileIndex != _musicTrackMap[t] || _curMusicFileExt != (char)_musicTrackMap[t + 1]) {
|
||||
if (t >= 0 && (_curMusicFileIndex != _musicTrackMap[t] || _curMusicFileExt != (char)_musicTrackMap[t + 1])) {
|
||||
snd_stopMusic();
|
||||
_sound->loadSoundFile(Common::String::format("LORE%02d%c", _musicTrackMap[t], (char)_musicTrackMap[t + 1]));
|
||||
_curMusicFileIndex = _musicTrackMap[t];
|
||||
|
Loading…
Reference in New Issue
Block a user