Skip to content

Fix handling of atomic nodes in RegexCompiler / source generator - #66046

Merged
stephentoub merged 2 commits into
dotnet:mainfrom
stephentoub:fixatomiccodegen
Mar 3, 2022
Merged

stephentoub merged 2 commits into
dotnet:mainfrom
stephentoub:fixatomiccodegen

Conversation

@stephentoub

Copy link
Copy Markdown
Member

We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.

@ghost

ghost commented Mar 2, 2022

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions
See info in area-owners.md if you want to be subscribed.

Issue Details

We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.

Author: stephentoub
Assignees: -
Labels:

area-System.Text.RegularExpressions

Milestone: 7.0.0

@stephentoub

Copy link
Copy Markdown
Member Author

Thanks, @joperezr. I realized we have a similar issue for positive/negative lookaheads, which are implicitly atomic, so I pushed a small commit to address those, too.

@stephentoub
stephentoub force-pushed the fixatomiccodegen branch 2 times, most recently from e7a3117 to 091d2f0 Compare March 3, 2022 04:11
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
@stephentoub
stephentoub merged commit b410984 into dotnet:main Mar 3, 2022
@stephentoub
stephentoub deleted the fixatomiccodegen branch March 3, 2022 16:24
@ghost ghost locked as resolved and limited conversation to collaborators Apr 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants