From 7ea3f5b464e1526a1ba16c1f9658d142685856f1 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 26 Jan 2020 12:48:35 -0800 Subject: [PATCH] Fixed bug 4898 - No rumble because of integer overflow in SDL_JoystickRumble meyraud705 Switch hidapi and xinput also need to check for overflow, attached a patch for them. --- src/joystick/windows/SDL_xinputjoystick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/joystick/windows/SDL_xinputjoystick.c b/src/joystick/windows/SDL_xinputjoystick.c index 8fa2bb289..af85bec7c 100644 --- a/src/joystick/windows/SDL_xinputjoystick.c +++ b/src/joystick/windows/SDL_xinputjoystick.c @@ -480,7 +480,7 @@ SDL_XINPUT_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, } if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) { - joystick->hwdata->rumble_expiration = SDL_GetTicks() + duration_ms; + joystick->hwdata->rumble_expiration = SDL_GetTicks() + SDL_min(duration_ms, SDL_MAX_RUMBLE_DURATION_MS); } else { joystick->hwdata->rumble_expiration = 0; }