mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
JS: Extend RegExpTerm in ReDoS
This commit is contained in:
@@ -83,7 +83,7 @@ import javascript
|
|||||||
* A branch in a disjunction that is the root node in a literal, or a literal
|
* A branch in a disjunction that is the root node in a literal, or a literal
|
||||||
* whose root node is not a disjunction.
|
* whose root node is not a disjunction.
|
||||||
*/
|
*/
|
||||||
class RegExpRoot extends @regexpterm {
|
class RegExpRoot extends RegExpTerm {
|
||||||
RegExpParent parent;
|
RegExpParent parent;
|
||||||
|
|
||||||
// RegExpTerm is abstract, so do not extend it.
|
// RegExpTerm is abstract, so do not extend it.
|
||||||
@@ -94,9 +94,9 @@ class RegExpRoot extends @regexpterm {
|
|||||||
parent = alt.getParent()
|
parent = alt.getParent()
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
this.(RegExpTerm).isRootTerm() and
|
this.isRootTerm() and
|
||||||
not this instanceof RegExpAlt and
|
not this instanceof RegExpAlt and
|
||||||
parent = this.(RegExpTerm).getParent()
|
parent = this.getParent()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,8 +114,6 @@ class RegExpRoot extends @regexpterm {
|
|||||||
parent.(StringLiteral).flow() instanceof RegExpPatternSource
|
parent.(StringLiteral).flow() instanceof RegExpPatternSource
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
string toString() { result = this.(RegExpTerm).toString() }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user