1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

* src/regex-emacs.c (mutually_exclusive_p): Fix inf-loop (bug#65726)

This commit is contained in:
Stefan Monnier 2023-09-04 13:11:31 -04:00
parent 1d3d419607
commit 6fad73d7cc

View File

@ -3834,7 +3834,7 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, re_char *p1,
EXTRACT_NUMBER_AND_INCR (mcnt, p2); EXTRACT_NUMBER_AND_INCR (mcnt, p2);
/* Don't just test `mcnt > 0` because non-greedy loops have /* Don't just test `mcnt > 0` because non-greedy loops have
their test at the end with an unconditional jump at the start. */ 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) return (mutually_exclusive_p (bufp, p1, p2)
&& mutually_exclusive_p (bufp, p1, p2 + mcnt)); && mutually_exclusive_p (bufp, p1, p2 + mcnt));
break; break;