Fixed Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).

main
Sam Lantinga 2023-12-04 21:55:34 -08:00
parent 91da942b33
commit 02a116217d
1 changed files with 2 additions and 2 deletions

View File

@ -799,8 +799,8 @@ static int SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL_
Uint64 now = SDL_GetTicks();
if (now >= (clickstate->last_timestamp + mouse->double_click_time) ||
SDL_fabs(mouse->x - clickstate->last_x) > mouse->double_click_radius ||
SDL_fabs(mouse->y - clickstate->last_y) > mouse->double_click_radius) {
SDL_fabs((double)mouse->x - clickstate->last_x) > mouse->double_click_radius ||
SDL_fabs((double)mouse->y - clickstate->last_y) > mouse->double_click_radius) {
clickstate->click_count = 0;
}
clickstate->last_timestamp = now;