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
Avoid compiler hang from invalid text in AdditionalFiles #868
Conversation
…eRegex and MemberReferenceRegex to prevent CPU hang when given input that can cause expensive regex backtracking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this. Just a couple touch-ups, please.
src/Microsoft.VisualStudio.Threading.Analyzers/CommonInterest.cs
Outdated
Show resolved
Hide resolved
@bluetarpmedia tip: Please use descriptive PR titles. You already use the magic |
…de review. Co-authored-by: Andrew Arnott <andrewarnott@gmail.com>
Will do, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Looks like the Linux job failed when restoring packages:
|
Added a timeout to
NegatableTypeOrMemberReferenceRegex
andMemberReferenceRegex
to prevent a CPU hang when given input that causes (what I believe to be) very expensive regex backtracking.Incidentally, some invalid input causes a hang but other invalid input just causes a no-match (as expected).
These cause a hang (or timeout when the Regex is given one):
But the following do not hang and instead return a Regex with no match (as expected).
Maybe there's something internal to Regex which changes its implementation depending on the length of the input string?
Closes #485