-
-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
C-diagnosticsWarnings and errors reported by PomskyWarnings and errors reported by PomskyenhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
Most regex engines supported by Pomsky use backtracking. This means that Pomsky is susceptible to catastrophic backtracking. This should be detected and issue a warning (unless Rust is targeted, which does not backtrack).
Describe the solution you'd like
The regular-expressions.info page about catastrophic backtracking recommends:
The solution is simple. When nesting repetition operators, make absolutely sure that there is only one way to match the same match.
But is this sufficient? A real-word example where backtracking crippled a CloudFlare service was the regex
(?:\"|'|\]|\}|\\|\d|nan|infinity|true|false|null|undefined|symbol|math|\`|\-|\+)+[)]*;?(?:\s|-|~|!|{}|\|\||\+)*.*(?:.*=.*)
Which can be simplified and summarized like this:
something* .* .* '=' .*
There is no nested repetition, yet it is susceptible to catastrophic backtracking.
Metadata
Metadata
Assignees
Labels
C-diagnosticsWarnings and errors reported by PomskyWarnings and errors reported by PomskyenhancementNew feature or requestNew feature or request