Skip to content
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

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

Merged
merged 2 commits into from
Mar 3, 2022

Conversation

stephentoub
Copy link
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
Copy link

ghost commented Mar 2, 2022

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
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