JS: Extend RegExpTerm in ReDoS

This commit is contained in:
Asger F
2019-10-22 12:34:33 +01:00
parent b6c1c174a9
commit b8711fc642

View File

@@ -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() }
} }
/** /**