From ed4ba79ea8f2be2d01f6447910e2c8319908d0d6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 15 Jul 2022 13:49:56 +0300 Subject: [PATCH] Avoid infloop in redisplay when displaying a tooltip * src/xdisp.c (try_window): Ensure we fail if 'display_line' indicates that the dimensions of the glyph matrix are insufficient. (Bug#56561) --- src/xdisp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/xdisp.c b/src/xdisp.c index f205327cc34..1940d16a013 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20200,9 +20200,16 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) /* Display all lines of W. */ while (it.current_y < it.last_visible_y) { + int last_row_scale = it.w->nrows_scale_factor; + int last_col_scale = it.w->ncols_scale_factor; if (display_line (&it, cursor_vpos)) last_text_row = it.glyph_row - 1; - if (f->fonts_changed && !(flags & TRY_WINDOW_IGNORE_FONTS_CHANGE)) + if (f->fonts_changed + && !((flags & TRY_WINDOW_IGNORE_FONTS_CHANGE) + /* If the matrix dimensions are insufficient, we _must_ + fail and let dispnew.c reallocate the matrix. */ + && last_row_scale == it.w->nrows_scale_factor + && last_col_scale == it.w->ncols_scale_factor)) return 0; } -- 2.39.2