diff --git a/python/ql/lib/semmle/python/regex.qll b/python/ql/lib/semmle/python/regex.qll index ef7c12ac6a5..fd18cd49276 100644 --- a/python/ql/lib/semmle/python/regex.qll +++ b/python/ql/lib/semmle/python/regex.qll @@ -204,8 +204,7 @@ abstract class RegexString extends Expr { | end = inner_end + 1 and inner_end > inner_start and - this.nonEscapedCharAt(inner_end) = "]" and - not exists(int mid | this.nonEscapedCharAt(mid) = "]" | mid > inner_start and mid < inner_end) + inner_end = min(int i | this.nonEscapedCharAt(i) = "]" and inner_start < i) ) } @@ -344,9 +343,8 @@ abstract class RegexString extends Expr { this.escapingChar(start) and this.getChar(start + 1) = "N" and this.getChar(start + 2) = "{" and - this.getChar(end - 1) = "}" and end > start and - not exists(int i | start + 2 < i and i < end - 1 | this.getChar(i) = "}") + end - 1 = min(int i | start + 2 < i and this.getChar(i) = "}") } /**