Fixed bug 3701 - WM_TOUCH message may cause calls to null if touch functions are not properly loaded
authorSam Lantinga <slouken@libsdl.org>
Wed, 09 Aug 2017 20:26:16 -0700
changeset 1121551aeabb61b2e
parent 11214 f8390acaa735
child 11216 908e4fe53f5a
Fixed bug 3701 - WM_TOUCH message may cause calls to null if touch functions are not properly loaded

Simon Hug

When WIN_WindowProc processes the WM_TOUCH message, it doesn't check if the touch functions have been properly loaded and may call a NULL pointer. It's probably an extremely rare case, but here's a patch that adds some checks anyway.
src/video/windows/SDL_windowsevents.c
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Wed Aug 09 20:23:48 2017 -0700
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Wed Aug 09 20:26:16 2017 -0700
     1.3 @@ -884,7 +884,7 @@
     1.4          break;
     1.5  
     1.6      case WM_TOUCH:
     1.7 -        {
     1.8 +        if (data->videodata->GetTouchInputInfo && data->videodata->CloseTouchInputHandle) {
     1.9              UINT i, num_inputs = LOWORD(wParam);
    1.10              PTOUCHINPUT inputs = SDL_stack_alloc(TOUCHINPUT, num_inputs);
    1.11              if (data->videodata->GetTouchInputInfo((HTOUCHINPUT)lParam, num_inputs, inputs, sizeof(TOUCHINPUT))) {