From: <sv...@op...> - 2024-06-08 12:35:19
|
Author: sagamusix Date: Sat Jun 8 14:35:12 2024 New Revision: 20956 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20956 Log: [Fix] GT2: Don't write to ChnSettings past the last channel. Modified: trunk/OpenMPT/soundlib/Load_gt2.cpp Modified: trunk/OpenMPT/soundlib/Load_gt2.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_gt2.cpp Sat Jun 8 14:24:39 2024 (r20955) +++ trunk/OpenMPT/soundlib/Load_gt2.cpp Sat Jun 8 14:35:12 2024 (r20956) @@ -1259,7 +1259,8 @@ { // Only channel mute status is of interest here uint32 muteStatus = chunk.ReadUint32BE(); - for(CHANNELINDEX i = 0; i < 32; i++) + const CHANNELINDEX numChannels = std::min(GetNumChannels(), CHANNELINDEX(32)); + for(CHANNELINDEX i = 0; i < numChannels; i++) { ChnSettings[i].dwFlags.set(CHN_MUTE, !(muteStatus & (1u << i))); } |