From 22b38f513c93c2f2aea5909878c3c9acae7d35c1 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Sat, 3 Oct 2009 12:44:50 +0100 Subject: [PATCH] Cygwin/X: Avoid a potential null pointer dereference before input initialization Avoid a null pointer dereference if WM_MOUSEMOVE occurred before the input device had been initialized (a timing sensitive bug occassionally seen during initialization) Signed-off-by: Jon TURNEY Reviewed-by: Colin Harrison --- hw/xwin/winwndproc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c index d72a5f135..5e8451082 100644 --- a/hw/xwin/winwndproc.c +++ b/hw/xwin/winwndproc.c @@ -717,6 +717,10 @@ winWindowProc (HWND hwnd, UINT message, if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; + /* We can't do anything without g_pwinPointer */ + if (g_pwinPointer == NULL) + break; + /* Has the mouse pointer crossed screens? */ if (s_pScreen != miPointerGetScreen(g_pwinPointer)) miPointerSetScreen (g_pwinPointer, s_pScreenInfo->dwScreen,