Browse Source

Fix undefined behavior in SDL_windowsmouse.c

This fix prevents C undefined behavior from being invoked on Windows
if the user's configured cursor speed is below 6.
Carl Åstholm 2 months ago
parent
commit
c21bc48a70
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/video/windows/SDL_windowsmouse.c

+ 1 - 1
src/video/windows/SDL_windowsmouse.c

@@ -710,7 +710,7 @@ void WIN_UpdateMouseSystemScale(void)
     int v = 10;
     if (SystemParametersInfo(SPI_GETMOUSESPEED, 0, &v, 0)) {
         v = SDL_max(1, SDL_min(v, 20));
-        data->dpiscale = SDL_max(SDL_max(v, (v - 2) << 2), (v - 6) << 3);
+        data->dpiscale = SDL_max(SDL_max(v, (v - 2) * 4), (v - 6) * 8);
     }
 
     int params[3];