From ce07be1a791420ab1ed2dda7474452626a35016b Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Thu, 24 Feb 2022 10:34:02 -0800 Subject: [PATCH] winedbg: Sanity check the dwType field of MSVC thread naming exceptions. Signed-off-by: Brendan Shanks Signed-off-by: Alexandre Julliard --- programs/winedbg/gdbproxy.c | 2 ++ programs/winedbg/tgt_active.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c index e7f9ddaf226..89985c06666 100644 --- a/programs/winedbg/gdbproxy.c +++ b/programs/winedbg/gdbproxy.c @@ -485,6 +485,8 @@ static BOOL handle_exception(struct gdb_context* gdbctx, EXCEPTION_DEBUG_INFO* e char name[9]; SIZE_T read; + if (threadname->dwType != 0x1000) + return FALSE; if (threadname->dwThreadID == -1) thread = dbg_get_thread(gdbctx->process, gdbctx->de.dwThreadId); else diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c index 8c365a1e55d..50f48e8d1b8 100644 --- a/programs/winedbg/tgt_active.c +++ b/programs/winedbg/tgt_active.c @@ -245,6 +245,9 @@ static DWORD dbg_handle_exception(const EXCEPTION_RECORD* rec, BOOL first_chance break; case EXCEPTION_WINE_NAME_THREAD: pThreadName = (const THREADNAME_INFO*)(rec->ExceptionInformation); + + if (pThreadName->dwType != 0x1000) + return DBG_EXCEPTION_NOT_HANDLED; if (pThreadName->dwThreadID == -1) pThread = dbg_curr_thread; else