[PATCH v2 1/4] winedbg: Sanity check the dwType field of MSVC thread naming exceptions.

Brendan Shanks bshanks at codeweavers.com
Thu Feb 24 12:34:02 CST 2022


Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
---
 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
-- 
2.34.1




More information about the wine-devel mailing list