From 843293bed0601dd115a70b2f9e94800d6eb2babc Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 9 Aug 2017 20:26:16 -0700 Subject: [PATCH] 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 926f526f8..afa2d71c1 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -884,7 +884,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_TOUCH: - { + if (data->videodata->GetTouchInputInfo && data->videodata->CloseTouchInputHandle) { UINT i, num_inputs = LOWORD(wParam); PTOUCHINPUT inputs = SDL_stack_alloc(TOUCHINPUT, num_inputs); if (data->videodata->GetTouchInputInfo((HTOUCHINPUT)lParam, num_inputs, inputs, sizeof(TOUCHINPUT))) {