Skip to content

Commit c7ddd2c

Browse files
committed
Python: make test for unicode names pass
1 parent de50aab commit c7ddd2c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

python/ql/src/semmle/python/regex.qll

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ abstract class RegexString extends Expr {
128128
private predicate singleEscape(int i) {
129129
exists(string c |
130130
c = this.getChar(i) and
131-
c != "x" and c != "U"
131+
c != "x" and c != "U" and c!= "N"
132132
)
133133
}
134134

@@ -143,6 +143,16 @@ abstract class RegexString extends Expr {
143143
or
144144
this.getChar(start + 1) = "U" and end = start + 10
145145
or
146+
this.getChar(start + 1) = "N" and
147+
this.getChar(start + 2) = "{" and
148+
this.getChar(end - 1) = "}" and
149+
end > start and
150+
not exists(int i |
151+
i > start + 2 and
152+
i < end - 1 and
153+
this.getChar(i) = "}"
154+
)
155+
or
146156
this.singleEscape(start + 1) and end = start + 2
147157
)
148158
}

0 commit comments

Comments
 (0)