[Scummvm-git-logs] scummvm master -> 1fd16c11e207fcf6c0ebaa82b4c9239d38d00f6b

eriktorbjorn noreply at scummvm.org
Sun Oct 9 13:25:19 UTC 2022


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

Summary:
1fd16c11e2 SCUMM: Fix infinite-ish loop in IMuseDriver_MT32::initDevice()


Commit: 1fd16c11e207fcf6c0ebaa82b4c9239d38d00f6b
    https://github.com/scummvm/scummvm/commit/1fd16c11e207fcf6c0ebaa82b4c9239d38d00f6b
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2022-10-09T15:25:03+02:00

Commit Message:
SCUMM: Fix infinite-ish loop in IMuseDriver_MT32::initDevice()

If infoStr was longer than 20 characters, 20 - infoStr.size() would turn
into a very large positive number, causing the string-padding loop to
run "forever".

Changed paths:
    engines/scumm/imuse/drivers/midi.cpp


diff --git a/engines/scumm/imuse/drivers/midi.cpp b/engines/scumm/imuse/drivers/midi.cpp
index a6319eb8535..1f3a93383e0 100644
--- a/engines/scumm/imuse/drivers/midi.cpp
+++ b/engines/scumm/imuse/drivers/midi.cpp
@@ -893,7 +893,7 @@ void IMuseDriver_MT32::initDevice() {
 
 	// Display a welcome message on MT-32 displays. Compute version string (truncated to 20 chars max.)
 	Common::String infoStr = Common::String("ScummVM ") + gScummVMVersion;
-	for (int i = (20 - infoStr.size()) >> 1; i > 0; --i)
+	for (int i = (20 - (int)infoStr.size()) >> 1; i > 0; --i)
 		infoStr = ' ' + infoStr + ' ';
 	sendMT32Sysex(0x80000, (const byte*)infoStr.c_str(), MIN<uint32>(infoStr.size(), 20));
 	g_system->delayMillis(1000);




More information about the Scummvm-git-logs mailing list