From b1e92c59ede2e67e36531a35ecb4ccabeaa68ff6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 28 Sep 2022 16:46:39 +0300 Subject: [PATCH] Avoid assertion violations in 'pop_it' * src/xdisp.c (pop_it): Avoid assertion violations when handling lists or vectors of display properties. (Bug#58122) --- src/xdisp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/xdisp.c b/src/xdisp.c index 6d42105474f..f5f3a811e9d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -6755,7 +6755,14 @@ pop_it (struct it *it) || (STRINGP (it->object) && IT_STRING_CHARPOS (*it) == it->bidi_it.charpos && IT_STRING_BYTEPOS (*it) == it->bidi_it.bytepos) - || (CONSP (it->object) && it->method == GET_FROM_STRETCH)); + || (CONSP (it->object) && it->method == GET_FROM_STRETCH) + /* We could be in the middle of handling a list or a + vector of several 'display' properties, in which + case we should only verify the above conditions when + we pop the iterator stack the last time, because + higher stack levels cannot "iterate out of the + display property". */ + || it->sp > 0); } /* If we move the iterator over text covered by a display property to a new buffer position, any info about previously seen overlays -- 2.39.2