From: <sv...@op...> - 2024-12-06 18:07:21
|
Author: sagamusix Date: Fri Dec 6 19:07:14 2024 New Revision: 22478 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22478 Log: [Fix] XM: In non-compatible linear slide mode, avoid shifting the period by arbitrary bit amounts if the period is extremely high. This caused the frequency to wrap around, which should not happen in non-compatible mode. Found with afl++ + ubsan. Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp Fri Dec 6 17:04:29 2024 (r22477) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp Fri Dec 6 19:07:14 2024 (r22478) @@ -6481,6 +6481,8 @@ octave = ((14 - div) & 0x1F); } else { + if(period > 29 * 768) + return 0; octave = (period / 768) + 2; } return (XMLinearTable[period % 768] << (FREQ_FRACBITS + 2)) >> octave; |