From 8fc1a444fa82ffaf5751cc87bd0ab470ee0cf307 Mon Sep 17 00:00:00 2001 From: Pip Cet Date: Sat, 12 Jul 2025 10:22:01 +0000 Subject: [PATCH] Avoid crashes when profiling multi-threaded Lisp (bug#76970) * src/eval.c (backtrace_p): Check 'current_thread' before dereferencing it. (cherry picked from commit fce86c7e9523b9b6c29241ae9d1dea340f0d849c) --- src/eval.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/eval.c b/src/eval.c index 2e96c584524..b606990a297 100644 --- a/src/eval.c +++ b/src/eval.c @@ -159,7 +159,11 @@ set_backtrace_debug_on_exit (union specbinding *pdl, bool doe) bool backtrace_p (union specbinding *pdl) -{ return specpdl ? pdl >= specpdl : false; } +{ + if (current_thread && specpdl && pdl) + return pdl >= specpdl; + return false; +} static bool backtrace_thread_p (struct thread_state *tstate, union specbinding *pdl) -- 2.39.5