GNU bug report logs - #34823
27.0.50; re-search-forward infloop

Previous Next

Package: emacs;

Reported by: Vitalie Spinu <spinuvit <at> gmail.com>

Date: Tue, 12 Mar 2019 10:50:01 UTC

Severity: normal

Merged with 6640, 20230, 31817

Found in versions 23.2, 24.4.91, 27.0.50

Full log


View this message in rfc822 format

From: Mattias EngdegÄrd <mattiase <at> acm.org>
To: 34823 <at> debbugs.gnu.org
Subject: bug#34823: 27.0.50; re-search-forward infloop
Date: Fri, 29 Mar 2019 14:28:18 +0100
It is not actually an infinite loop; it just takes a very long time.

Your case is, more or less, essentially

(search-string "\\(?:a*\\)*b" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")

Try trimming the string, and you will see that the match does terminate (and fail); it is just super-linear in the length of the text.
This is a shortcoming of the general type of regexp engine used by Emacs.

To work around your problem, you should make the regexp less prone to backtracking. Try asking on the list help-gnu-emacs <at> gnu.org for advice. Describe what text you wish to match as precisely as possible.





This bug report was last modified 6 years and 74 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.