Author: sagamusix
Date: Sat Mar 23 14:18:33 2024
New Revision: 20422
URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20422
Log:
[Fix] Avoid using infinity as map key when calculating pattern loop times to avoid UB (found with afl-fuzz + asan).
Modified:
branches/OpenMPT-1.29/soundlib/Snd_fx.cpp
Modified: branches/OpenMPT-1.29/soundlib/Snd_fx.cpp
==============================================================================
--- branches/OpenMPT-1.29/soundlib/Snd_fx.cpp Thu Mar 21 21:52:34 2024 (r20421)
+++ branches/OpenMPT-1.29/soundlib/Snd_fx.cpp Sat Mar 23 14:18:33 2024 (r20422)
@@ -1249,6 +1249,8 @@
|| (command == CMD_MODCMDEX && param >= 0x61 && param <= 0x6F))
{
const double start = memory.chnSettings[nChn].patLoop;
+ if(!std::isnormal(start))
+ break;
if(!startTimes[start]) startTimes[start] = 1;
startTimes[start] = std::lcm(startTimes[start], 1 + (param & 0x0F));
}
|