[Scummvm-git-logs] scummvm master -> 13c182379a110431e94ddb56dc9419a67d21df22

athrxx noreply at scummvm.org
Sat Apr 26 12:01:14 UTC 2025


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
13c182379a KYRA: fix bug no. 15901


Commit: 13c182379a110431e94ddb56dc9419a67d21df22
    https://github.com/scummvm/scummvm/commit/13c182379a110431e94ddb56dc9419a67d21df22
Author: athrxx (athrxx at scummvm.org)
Date: 2025-04-26T13:58:26+02:00

Commit Message:
KYRA: fix bug no. 15901

(KYRA: SoundTownsPC98_v2::playTrack() heap
buffer-overflow (ASan))

Changed paths:
    engines/kyra/sound/sound_intern.h
    engines/kyra/sound/sound_pc98_v2.cpp


diff --git a/engines/kyra/sound/sound_intern.h b/engines/kyra/sound/sound_intern.h
index f25c88676ae..b1b8696d3e0 100644
--- a/engines/kyra/sound/sound_intern.h
+++ b/engines/kyra/sound/sound_intern.h
@@ -238,7 +238,7 @@ private:
 	uint8 *_sfxTrackData;
 	TownsPC98_AudioDriver *_driver;
 
-	const SoundResourceInfo_TownsPC98V2 *res() const {return _resInfo[_currentResourceSet]; }
+	const SoundResourceInfo_TownsPC98V2 *res() const { return _resInfo[_currentResourceSet]; }
 	SoundResourceInfo_TownsPC98V2 *_resInfo[3];
 	int _currentResourceSet;
 };
diff --git a/engines/kyra/sound/sound_pc98_v2.cpp b/engines/kyra/sound/sound_pc98_v2.cpp
index 9da52b43a57..fe5d4f5eb42 100644
--- a/engines/kyra/sound/sound_pc98_v2.cpp
+++ b/engines/kyra/sound/sound_pc98_v2.cpp
@@ -122,9 +122,9 @@ void SoundTownsPC98_v2::playTrack(uint8 track) {
 
 	int trackNum = -1;
 	if (_vm->gameFlags().platform == Common::kPlatformFMTowns) {
-		for (uint i = 0; i < res()->cdaTableSize; i++) {
-			if (track == (uint8)READ_LE_UINT16(&res()->cdaTable[i * 2])) {
-				trackNum = (int)READ_LE_UINT16(&res()->cdaTable[i * 2 + 1]) - 1;
+		for (uint i = 0; i < res()->cdaTableSize >> 1; i++) {
+			if (track == (uint8)res()->cdaTable[i * 2]) {
+				trackNum = (int8)res()->cdaTable[i * 2 + 1] - 1;
 				break;
 			}
 		}




More information about the Scummvm-git-logs mailing list