From 3b9f645bdd315f5ba56438db8ba1369c05e653af Mon Sep 17 00:00:00 2001 From: agent-zeroo Date: Sun, 17 May 2026 16:43:04 +0000 Subject: [PATCH] gh-149953: Fix null pointer dereference order in code_objects.c Move check before to prevent null pointer dereference when unwinder is NULL. C short-circuit evaluation means the second operand is evaluated before the third, so would crash before reaching the NULL check. Co-authored-by: agent-zeroo --- Modules/_remote_debugging/code_objects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/_remote_debugging/code_objects.c b/Modules/_remote_debugging/code_objects.c index 7b95c0f2d4fa8d..97c6ba772e88f1 100644 --- a/Modules/_remote_debugging/code_objects.c +++ b/Modules/_remote_debugging/code_objects.c @@ -432,7 +432,7 @@ parse_code_object(RemoteUnwinderObject *unwinder, #ifdef Py_GIL_DISABLED // Handle thread-local bytecode (TLBC) in free threading builds - if (ctx->tlbc_index == 0 || unwinder->debug_offsets.code_object.co_tlbc == 0 || unwinder == NULL) { + if (ctx->tlbc_index == 0 || unwinder == NULL || unwinder->debug_offsets.code_object.co_tlbc == 0) { // No TLBC or no unwinder - use main bytecode directly addrq = (uint16_t *)ip - (uint16_t *)meta->addr_code_adaptive; goto done_tlbc;