From 720ed0b5334c9667b2fdc4d3f5e8975865e9f962 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Dec 2017 13:59:07 +0200 Subject: [PATCH] Avoid crashes when ':eval' deletes our frame * src/xdisp.c (display_mode_element): Signal an error if ':eval' somehow deletes the frame whose window we are redisplaying. (Bug#29726) --- src/xdisp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/xdisp.c b/src/xdisp.c index 538c3e6b87e..f6e98daa329 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -23685,6 +23685,14 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, { Lisp_Object spec; spec = safe__eval (true, XCAR (XCDR (elt))); + /* The :eval form could delete the frame stored in the + iterator, which will cause a crash if we try to + access faces and other fields (e.g., FRAME_KBOARD) + on that frame. This is a nonsensical thing to do, + and signaling an error from redisplay might be + dangerous, but we cannot continue with an invalid frame. */ + if (!FRAME_LIVE_P (it->f)) + signal_error (":eval deleted the frame being displayed", elt); n += display_mode_element (it, depth, field_width - n, precision - n, spec, props, risky); -- 2.11.4.GIT