From 509dec902c45bc11cd8ff6664795b471d451742c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 5 Dec 2021 17:34:05 +0200 Subject: [PATCH] Fix out-of-bounds access in xdisp.c * src/xdisp.c (produce_stretch_glyph): Avoid indexing it->stack with a negative index. Reported by Po Lu . --- src/xdisp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/xdisp.c b/src/xdisp.c index b2eeb1105b1..45b502590d1 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -30391,7 +30391,8 @@ produce_stretch_glyph (struct it *it) if (width > 0 && height > 0 && it->glyph_row) { Lisp_Object o_object = it->object; - Lisp_Object object = it->stack[it->sp - 1].string; + Lisp_Object object = + it->sp > 0 ? it->stack[it->sp - 1].string : it->string; int n = width; if (!STRINGP (object)) -- 2.39.5