From ba7671604c5c7f1410a389c0c2d51e6d52ced23e Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Fri, 16 Dec 2016 10:01:10 -0500 Subject: [PATCH] Fixed a bug where the non-existence of a search term in the document resulted in an infinite loop --- libedit/buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libedit/buf.c b/libedit/buf.c index 2013867..268d20d 100644 --- a/libedit/buf.c +++ b/libedit/buf.c @@ -387,7 +387,7 @@ void buf_findstr(Buf* buf, char* str, size_t* beg, size_t* end) { Rune* runes = charstorunes(str); size_t rlen = runelen(runes); unsigned start = *beg, mbeg = start+1, mend = mbeg + rlen; - while (true) { + while (mbeg != start) { if ((buf_get(buf, mbeg) == runes[0]) && (buf_get(buf, mend-1) == runes[rlen-1]) && (0 == rune_match(buf, mbeg, mend, runes))) -- 2.54.0