From f452b18e877fd79916f9494fc6f09663127327e1 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 14 Feb 2026 12:39:03 +0200 Subject: [PATCH] ; * src/xfaces.c (face_at_buffer_position): Fix next_overlay per bug#80242. --- src/xfaces.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/xfaces.c b/src/xfaces.c index 71ff895e210..a27e1c6b480 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -6928,6 +6928,10 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos, { ptrdiff_t next_overlay; GET_OVERLAYS_AT (pos, overlay_vec, noverlays, &next_overlay); + /* overlays_at can return next_overlay beyond the end of the current + narrowing. We don't want that to leak into the display code. */ + if (next_overlay > ZV) + next_overlay = ZV; if (next_overlay < endpos) endpos = next_overlay; }