-
Notifications
You must be signed in to change notification settings - Fork 5k
More timeout checks in RegexOptions.NonBacktracking #74531
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
Conversation
Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions Issue DetailsThis PR adds timeout checking into matching loops in all phases of The constants configuring those numbers of iterations are moved into This PR includes the bug fix from #74525 to avoid a conflict after that one is merged.
|
5056870
to
45671cd
Compare
Hey @olsaarik sorry for missing this. Is this ready for review? |
friendly ping @olsaarik 😄 Are you waiting on a review for this? |
Thanks for the ping. If I remember correctly I mostly finished this, but I'll give it a look and make sure all the tests pass. I'll let you know when it's ready for review |
@olsaarik, could you let us know if you had a chance to look at this? Thanks! |
@olsaarik, if the PR is not ready yet, should we convert it to draft? |
This had dropped off my radar. Returned to draft now and I'll get back to it. |
Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it. |
Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it. |
This PR adds timeout checking into matching loops in all phases of
RegexOptions.NonBacktracking
, while previously only the first "find the end position" phase had the check. The second "find the start position by walking backwards" phase uses the same number of innermost loop iterations between cheks as the first one. However, the third phase for finding subcaptures uses a lower one to account for the phase being slower in general. I measured that the 100 characters per timeout check gives around a 15ms resolution in the third phase.The constants configuring those numbers of iterations are moved into
SymbolicRegexThresholds
.This PR includes the bug fix from #74525 to avoid a conflict after that one is merged.