Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c4153a6 commit 58c31f0Copy full SHA for 58c31f0
1 file changed
javascript/ql/src/Performance/ReDoS.ql
@@ -103,7 +103,15 @@ class RegExpRoot extends RegExpTerm {
103
*/
104
predicate isRelevant() {
105
// there is at least one repetition
106
- exists(RegExpRepetition rep | getRoot(rep) = this) and
+ exists(RegExpRepetition rep | getRoot(rep) = this |
107
+ // that could possibly match the same thing in multiple ways.
108
+ exists(RegExpTerm child |
109
+ child instanceof RegExpAlt or
110
+ child instanceof RegExpQuantifier
111
+ |
112
+ child.getParent+() = rep
113
+ )
114
+ ) and
115
// there are no lookbehinds
116
not exists(RegExpLookbehind lbh | getRoot(lbh) = this) and
117
// is actually used as a RegExp
0 commit comments