[NTUSER] Fix BSOD 0x1E nullptr deref CORE-18899 (#5212)

fix authored by JIRA-user "TANGaming". I do suspect that the possibility of that nullptr deref was introduced on the master branch by 0.4.13-dev-962-g 4193b8d. Doug Lyons signalled his "ok" regarding the fix in chat already. CORE-18899
This commit is contained in:
Joachim Henze 2023-04-02 16:27:42 +02:00 committed by GitHub
parent c37addcbf5
commit 9ee9f73369
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 12 deletions

View file

@ -1,9 +1,8 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Win32k subsystem
* PURPOSE: Miscellaneous User functions
* FILE: win32ss/user/ntuser/defwnd.c
* PROGRAMER:
* PROJECT: ReactOS Win32k subsystem
* LICENSE: See COPYING in the top level directory
* PURPOSE: Miscellaneous User functions
* COPYRIGHT: 2008-2020 James Tabor <james.tabor@reactos.org>
*/
#include <win32k.h>
@ -797,6 +796,10 @@ IntDefWindowProc(
HWND hwndTop = UserGetForegroundWindow();
PWND topWnd = UserGetWindowObject(hwndTop);
// MS Doc: foreground window can be NULL, e.g. when window is losing activation
if (!topWnd)
return 0;
// We want to forbid snapping operations on the TaskBar
// We use a heuristic for detecting the TaskBar Wnd by its typical Style & ExStyle Values
ExStyleTB = (topWnd->ExStyle & WS_EX_TOOLWINDOW);
@ -805,7 +808,7 @@ IntDefWindowProc(
&& (ExStyleTB == WS_EX_TOOLWINDOW);
TRACE("ExStyle=%x Style=%x IsTaskBar=%d\n", ExStyleTB, StyleTB, IsTaskBar);
if (topWnd && !IsTaskBar)
if (!IsTaskBar)
{
if ((topWnd->style & WS_THICKFRAME) == 0)
return 0;

View file

@ -2,8 +2,7 @@
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PURPOSE: Window event handlers
* FILE: win32ss/user/ntuser/event.c
* PROGRAMER: James Tabor (james.tabor@rectos.org)
* PROGRAMER: James Tabor <james.tabor@reactos.org>
*/
#include <win32k.h>

View file

@ -2,10 +2,9 @@
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PURPOSE: Window hooks
* FILE: win32ss/user/ntuser/hook.c
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
* James Tabor (james.tabor@rectos.org)
* Rafal Harabien (rafalh@reactos.org)
* PROGRAMER: Casper S. Hornstrup <chorns@users.sourceforge.net>
* James Tabor <james.tabor@reactos.org>
* Rafal Harabien <rafalh@reactos.org>
* NOTE: Most of this code was adapted from Wine,
* Copyright (C) 2002 Alexandre Julliard
*/