-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinite loop in captures #375
Comments
The program for the regex is
and the
over and over. I'm not an expert with this codebase, but I suspect it may be compiling the regex to the wrong bytecode. Note that a similar regex
|
Closed
adamcrume
added a commit
to adamcrume/regex
that referenced
this issue
Jun 19, 2017
…pressions With certain repeated empty expressions similar to (x*)*?, the backtracker can go into an infinite loop. This change adds the Progress instruction which requires the engine to make progress to continue matching a repeated subexpression. Fixes rust-lang#375
adamcrume
added a commit
to adamcrume/regex
that referenced
this issue
Jun 19, 2017
…pressions With certain repeated empty expressions similar to (x*)*?, the backtracker can go into an infinite loop. This change adds the Progress instruction which requires the engine to make progress to continue matching a repeated subexpression. Fixes rust-lang#375
adamcrume
added a commit
to adamcrume/regex
that referenced
this issue
Jun 20, 2017
…step This prevents us from executing instructions if they have been executed before, rather than returning after the instruction has already been executed. Fixes rust-lang#375
bors
added a commit
that referenced
this issue
Jun 23, 2017
Move has_visited check to the top of the loop in backtrack::Bounded::step …pressions With certain repeated empty expressions similar to (x*)*?, the backtracker can go into an infinite loop. This change adds the Progress instruction which requires the engine to make progress to continue matching a repeated subexpression. Fixes #375 Note that this was inspired by https://swtch.com/~rsc/regexp/regexp2.html#real (mentioned in HACKING.md), which mentions that a progress instruction can be used to prevent backtracking loops.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running the code
against regex 0.2.2 results in an infinite loop. The stack trace is
(Not that the regex itself is useful; it was randomly generated.)
The text was updated successfully, but these errors were encountered: