From 4773c53f8faa847410adb5498c50d8687e3f0a01 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Wed, 31 Jul 2024 13:41:42 -0230 Subject: [PATCH] Fix potential overflow in cycle calculation. --- src/emucore/CartELF.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/emucore/CartELF.cxx b/src/emucore/CartELF.cxx index 24091b3df..c3bcb093e 100644 --- a/src/emucore/CartELF.cxx +++ b/src/emucore/CartELF.cxx @@ -542,8 +542,8 @@ void CartridgeELF::runArm() ) return; - const uInt32 cyclesGoal = - (mySystem->cycles() + ARM_RUNAHED_MAX) * myArmCyclesPer6502Cycle - getArmCycles(); + const uInt32 cyclesGoal = static_cast( + (mySystem->cycles() + ARM_RUNAHED_MAX) * myArmCyclesPer6502Cycle - getArmCycles()); uInt32 cycles = 0; const CortexM0::err_t err = myCortexEmu.run(cyclesGoal, cycles);