[Scummvm-git-logs] scummvm master -> 6484913762d32d78df433b8f8f18064390627821

athrxx noreply at scummvm.org
Fri Sep 30 01:07:14 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:
6484913762 SCUMM: fix bug no. 13867


Commit: 6484913762d32d78df433b8f8f18064390627821
    https://github.com/scummvm/scummvm/commit/6484913762d32d78df433b8f8f18064390627821
Author: athrxx (athrxx at scummvm.org)
Date: 2022-09-30T03:06:21+02:00

Commit Message:
SCUMM: fix bug no. 13867

This will actually read out of bounds in the orginal interpreter, too. I have fixed it to be more in line with the original (the value in question is always treated as unsigned here), but still not do anything harmful.

Changed paths:
    audio/adlib.cpp


diff --git a/audio/adlib.cpp b/audio/adlib.cpp
index 7d9493fb493..b4099128a8f 100644
--- a/audio/adlib.cpp
+++ b/audio/adlib.cpp
@@ -1897,8 +1897,8 @@ void MidiDriver_ADLIB::struct10Setup(Struct10 *s10) {
 
 void MidiDriver_ADLIB::adlibPlayNote(int channel, int note) {
 	byte old, oct, notex;
-	int note2;
-	int i;
+	uint8 note2;
+	int i; 
 
 	note2 = (note >> 7) - 4;
 	note2 = (note2 < 128) ? note2 : 0;
@@ -1927,6 +1927,7 @@ void MidiDriver_ADLIB::adlibPlayNote(int channel, int note) {
 	}
 
 	i = (notex << 3) + ((note >> 4) & 0x7);
+	assert(i < ARRAYSIZE(g_noteFrequencies));
 	adlibWrite(channel + 0xA0, g_noteFrequencies[i]);
 	adlibWrite(channel + 0xB0, oct | 0x20);
 }




More information about the Scummvm-git-logs mailing list