Skip to content

Conversation

@olsaarik
Copy link
Contributor

This adds more stack overflow avoidance to regex NonBacktracking's recursive algorithms. This includes all the fixes from dotnet/runtimelab#1662 plus additional ones found in a full audit we did with @veanes.

Restrict in SymbolicRegexNode and SymbolicRegexSet would've required it too, but they turned out to be dead code, so were removed.

olsaarik and others added 2 commits October 22, 2021 11:59
Remove unused Restrict methods instead of adding avoidance.

Co-authored-by: Stephen Toub <[email protected]>
This follows a full audit of the NonBacktracking code.
@ghost ghost added area-System.Text.RegularExpressions community-contribution Indicates that the PR has been added by a community member labels Oct 22, 2021
@ghost
Copy link

ghost commented Oct 22, 2021

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

Issue Details

This adds more stack overflow avoidance to regex NonBacktracking's recursive algorithms. This includes all the fixes from dotnet/runtimelab#1662 plus additional ones found in a full audit we did with @veanes.

Restrict in SymbolicRegexNode and SymbolicRegexSet would've required it too, but they turned out to be dead code, so were removed.

Author: olsaarik
Assignees: -
Labels:

area-System.Text.RegularExpressions

Milestone: -

@danmoseley
Copy link
Member

@olsaarik is it feasible to craft tests that hit some or all of these? otherwise the protection might "rot" during maintenance or feature work in future.

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add more depth tests for deep expressions, but that can be done separately.

@stephentoub stephentoub merged commit 9ba1b85 into dotnet:main Oct 24, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Nov 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Text.RegularExpressions community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants