From b8711fc64282f94e74b74e164a68f9913d4656d3 Mon Sep 17 00:00:00 2001 From: Asger F Date: Tue, 22 Oct 2019 12:34:33 +0100 Subject: [PATCH] JS: Extend RegExpTerm in ReDoS --- javascript/ql/src/Performance/ReDoS.ql | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/javascript/ql/src/Performance/ReDoS.ql b/javascript/ql/src/Performance/ReDoS.ql index c465b5981c5..77825698ee1 100644 --- a/javascript/ql/src/Performance/ReDoS.ql +++ b/javascript/ql/src/Performance/ReDoS.ql @@ -83,7 +83,7 @@ import javascript * A branch in a disjunction that is the root node in a literal, or a literal * whose root node is not a disjunction. */ -class RegExpRoot extends @regexpterm { +class RegExpRoot extends RegExpTerm { RegExpParent parent; // RegExpTerm is abstract, so do not extend it. @@ -94,9 +94,9 @@ class RegExpRoot extends @regexpterm { parent = alt.getParent() ) or - this.(RegExpTerm).isRootTerm() and + this.isRootTerm() 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 ) } - - string toString() { result = this.(RegExpTerm).toString() } } /**