Fixed bug 3438 - SDL_GameControllerEventWatcher: Log on event with value >= k_nMaxReverseEntries
authorSam Lantinga <slouken@libsdl.org>
Fri, 07 Oct 2016 18:24:34 -0700
changeset 10495f732781d7ddc
parent 10494 c54de4000f9f
child 10496 6660aa9120d6
Fixed bug 3438 - SDL_GameControllerEventWatcher: Log on event with value >= k_nMaxReverseEntries
src/joystick/SDL_gamecontroller.c
     1.1 --- a/src/joystick/SDL_gamecontroller.c	Mon Oct 03 11:35:34 2016 +0100
     1.2 +++ b/src/joystick/SDL_gamecontroller.c	Fri Oct 07 18:24:34 2016 -0700
     1.3 @@ -145,7 +145,11 @@
     1.4          {
     1.5              SDL_GameController *controllerlist;
     1.6  
     1.7 -            if (event->jaxis.axis >= k_nMaxReverseEntries) break;
     1.8 +            if (event->jaxis.axis >= k_nMaxReverseEntries)
     1.9 +            {
    1.10 +                SDL_SetError("SDL_GameControllerEventWatcher: Axis index %d too large, ignoring motion", (int)event->jaxis.axis);
    1.11 +                break;
    1.12 +            }
    1.13  
    1.14              controllerlist = SDL_gamecontrollers;
    1.15              while (controllerlist) {
    1.16 @@ -176,7 +180,11 @@
    1.17          {
    1.18              SDL_GameController *controllerlist;
    1.19  
    1.20 -            if (event->jbutton.button >= k_nMaxReverseEntries) break;
    1.21 +            if (event->jbutton.button >= k_nMaxReverseEntries)
    1.22 +            {
    1.23 +                SDL_SetError("SDL_GameControllerEventWatcher: Button index %d too large, ignoring update", (int)event->jbutton.button);
    1.24 +                break;
    1.25 +            }
    1.26  
    1.27              controllerlist = SDL_gamecontrollers;
    1.28              while (controllerlist) {