Skip to content

Commit 67be20f

Browse files
authored
Python: Remove implied inequalities
Also gets rid of `inner_end`, since we're already doing `end - 1 = ...` in the other fix (and so this is more consistent).
1 parent 22aa4c9 commit 67be20f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

python/ql/lib/semmle/python/regex.qll

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,11 @@ abstract class RegexString extends Expr {
198198

199199
/** Whether there is a character class, between start (inclusive) and end (exclusive) */
200200
predicate charSet(int start, int end) {
201-
exists(int inner_start, int inner_end |
201+
exists(int inner_start |
202202
this.char_set_start(start, inner_start) and
203203
not this.char_set_start(_, start)
204204
|
205-
end = inner_end + 1 and
206-
inner_end > inner_start and
207-
inner_end = min(int i | this.nonEscapedCharAt(i) = "]" and inner_start < i)
205+
end - 1 = min(int i | this.nonEscapedCharAt(i) = "]" and inner_start < i)
208206
)
209207
}
210208

@@ -343,7 +341,6 @@ abstract class RegexString extends Expr {
343341
this.escapingChar(start) and
344342
this.getChar(start + 1) = "N" and
345343
this.getChar(start + 2) = "{" and
346-
end > start and
347344
end - 1 = min(int i | start + 2 < i and this.getChar(i) = "}")
348345
}
349346

0 commit comments

Comments
 (0)