]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid infinite recursion in 'window_wants_header_line'
authorEli Zaretskii <eliz@gnu.org>
Sat, 10 Jun 2023 08:48:37 +0000 (11:48 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 10 Jun 2023 08:48:37 +0000 (11:48 +0300)
* src/window.c (null_header_line_format): Avoid infinite
recursion by disallowing :eval on recursive calls.
(Bug#63988)

src/window.c

index 3802efb992a52827fe51f484354ed5c976a66bad..e22fea0bb7ababfc8c61e183af9816930e1751b5 100644 (file)
@@ -5470,6 +5470,7 @@ window_wants_mode_line (struct window *w)
          && WINDOW_PIXEL_HEIGHT (w) > WINDOW_FRAME_LINE_HEIGHT (w));
 }
 
+static int header_line_eval_called = 0;
 
 /**
  * null_header_line_format:
@@ -5497,9 +5498,18 @@ null_header_line_format (Lisp_Object fmt, struct frame *f)
        {
          if (EQ (car, QCeval))
            {
+             if (header_line_eval_called > 0)
+               return false;
+             eassert (header_line_eval_called == 0);
+             header_line_eval_called++;
              val = safe_eval_inhibit_quit (XCAR (XCDR (fmt)));
+             header_line_eval_called--;
+             eassert (header_line_eval_called == 0);
              if (!FRAME_LIVE_P (f))
-               signal_error (":eval deleted the frame being displayed", fmt);
+               {
+                 header_line_eval_called = 0;
+                 signal_error (":eval deleted the frame being displayed", fmt);
+               }
              return NILP (val);
            }
          val = find_symbol_value (car);