-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Fix NonBacktracking correctness issues and exponential blowup on nested loops #125457
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
base: main
Are you sure you want to change the base?
Changes from all commits
0de9177
39623a5
882dc6e
1c017ca
6e341c5
92b7c77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |||||
| // The .NET Foundation licenses this file to you under the MIT license. | ||||||
|
|
||||||
| using System.Globalization; | ||||||
| using System.Text; | ||||||
| using Xunit; | ||||||
| using System.Text.RegularExpressions.Symbolic; | ||||||
| using System.Collections.Generic; | ||||||
|
|
@@ -228,6 +229,25 @@ public static IEnumerable<object[]> UnsafeThresholdTests_MemberData() | |||||
| SymbolicRegexNode<BDD> rootNode = converter.ConvertToSymbolicRegexNode(tree); | ||||||
| yield return new object[] { rootNode }; | ||||||
| } | ||||||
|
|
||||||
| // Deeply nested unbounded loops with alternating laziness bypass loop flattening | ||||||
| // (which requires matching laziness) and cause exponential derivative blowup. | ||||||
| // CountSingletons accounts for this by multiplying by 2 per nesting level, so | ||||||
| // at depth 15+ the estimate exceeds the default 10,000 threshold. | ||||||
| // Build: (?:(?:(?:a)*?)*)*? ... with alternating greedy/lazy at each level | ||||||
|
||||||
| // Build: (?:(?:(?:a)*?)*)*? ... with alternating greedy/lazy at each level | |
| // Build: (?:(?:(?:a)*)*?)* ... with alternating greedy/lazy quantifiers at each level |
Uh oh!
There was an error while loading. Please reload this page.