>From 3d82dbc65c26d64f4dbef87e4dd3355eaf093ec0 Mon Sep 17 00:00:00 2001 From: Federico Tedin Date: Mon, 13 Apr 2020 15:30:58 +0200 Subject: [PATCH] Prevent hanging in next-single-char-property-change * src/textprop.c (Fnext_single_char_property_change): Prevent Emacs from hanging when the value of LIMIT is greater than the buffer's end position. (Bug#40000) --- src/textprop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/textprop.c b/src/textprop.c index 960dba3f8d..146cb2c76b 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -823,7 +823,7 @@ DEFUN ("next-single-char-property-change", Fnext_single_char_property_change, while (true) { position = Fnext_char_property_change (position, limit); - if (XFIXNAT (position) >= XFIXNAT (limit)) + if (XFIXNAT (position) >= XFIXNAT (limit) || XFIXNAT (position) >= ZV) { position = limit; break; -- 2.17.1