Zhiyi Zhang : comctl32: Check reference data pointer before using it.
Module: wine Branch: oldstable Commit: c1d1b74646d0d61487152b23529958ba6cfdd528 URL: https://gitlab.winehq.org/wine/wine/-/commit/c1d1b74646d0d61487152b23529958b... Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Tue Aug 16 11:25:46 2022 +0800 comctl32: Check reference data pointer before using it. Fix the crash when opening notepad++ v8.4.4 preference dialog before e52e42b. (cherry picked from commit 9b9fef2e112ff2ce0e1ce2da3aaacd2ffefa6d87) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/comctl32/commctrl.c | 3 ++- dlls/comctl32/tests/subclass.c | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/dlls/comctl32/commctrl.c b/dlls/comctl32/commctrl.c index b457bdcb8be..09061cc4c5e 100644 --- a/dlls/comctl32/commctrl.c +++ b/dlls/comctl32/commctrl.c @@ -1175,7 +1175,8 @@ BOOL WINAPI GetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass, while (proc) { if ((proc->id == uID) && (proc->subproc == pfnSubclass)) { - *pdwRef = proc->ref; + if (pdwRef) + *pdwRef = proc->ref; return TRUE; } proc = proc->next; diff --git a/dlls/comctl32/tests/subclass.c b/dlls/comctl32/tests/subclass.c index 9a3bece4a40..683323a0774 100644 --- a/dlls/comctl32/tests/subclass.c +++ b/dlls/comctl32/tests/subclass.c @@ -371,12 +371,8 @@ static void test_GetWindowSubclass(void) todo_wine ok(data == 0, "Got unexpected data %#Ix.\n", data); - /* Crash on Wine */ - if (strcmp(winetest_platform, "wine")) - { ret = pGetWindowSubclass(hwnd, wnd_proc_sub, 2, NULL); ok(ret, "GetWindowSubclass failed.\n"); - } data = 0xdeadbeef; ret = pGetWindowSubclass(hwnd, wnd_proc_sub, 2, &data);
participants (1)
-
Alexandre Julliard