[PATCH] winedbg: Fix crash when no process attached in 'info wnd' command

Eric Pouech eric.pouech at gmail.com
Fri Jul 2 02:43:32 CDT 2021

Ensure that ADDRSIZE and ADDRWIDTH macros can be used even when WineDbg
isn't attached to any process, by providing a default value.

Use case:
wine programs/winedbg/winedbg.exe.so
info wnd

was simply crashing.
(fixes #BZ49625 https://bugs.winehq.org/show_bug.cgi?id=49625)

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

 programs/winedbg/debugger.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h
index b7c765ac545..3733e1b410f 100644
--- a/programs/winedbg/debugger.h
+++ b/programs/winedbg/debugger.h
@@ -39,7 +39,7 @@
 #include "oaidl.h"
 #include <wine/list.h>
-#define ADDRSIZE        (dbg_curr_process->be_cpu->pointer_size)
+#define ADDRSIZE        (dbg_curr_process ? dbg_curr_process->be_cpu->pointer_size : (int)sizeof(void*))
 #define ADDRWIDTH       (ADDRSIZE * 2)
 /* the debugger uses these exceptions for its internal use */

More information about the wine-devel mailing list