From 6fad73d7cc53116962d8b0c07b13b8e7d5bc6f65 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 4 Sep 2023 13:11:31 -0400 Subject: [PATCH] * src/regex-emacs.c (mutually_exclusive_p): Fix inf-loop (bug#65726) --- src/regex-emacs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/regex-emacs.c b/src/regex-emacs.c index 2571812cb39..fb4e5b26b56 100644 --- a/src/regex-emacs.c +++ b/src/regex-emacs.c @@ -3834,7 +3834,7 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, re_char *p1, EXTRACT_NUMBER_AND_INCR (mcnt, p2); /* Don't just test `mcnt > 0` because non-greedy loops have their test at the end with an unconditional jump at the start. */ - if (p2 + mcnt > p2_orig) /* Ensure forward progress. */ + if (p2 > p2_orig && mcnt >= 0) /* Ensure forward progress. */ return (mutually_exclusive_p (bufp, p1, p2) && mutually_exclusive_p (bufp, p1, p2 + mcnt)); break; -- 2.39.2