File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
python/ql/src/semmle/python Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,14 @@ abstract class RegexString extends Expr {
124124 )
125125 }
126126
127+ // escaped characters without any special handling (yet)
128+ private predicate singleEscape ( int i ) {
129+ exists ( string c |
130+ c = this .getChar ( i ) and
131+ c != "x" and c != "U"
132+ )
133+ }
134+
127135 private predicate escapedCharacter ( int start , int end ) {
128136 this .escapingChar ( start ) and
129137 not exists ( this .getText ( ) .substring ( start + 1 , end + 1 ) .toInt ( ) ) and
@@ -133,7 +141,9 @@ abstract class RegexString extends Expr {
133141 end in [ start + 2 .. start + 4 ] and
134142 exists ( this .getText ( ) .substring ( start + 1 , end ) .toInt ( ) )
135143 or
136- this .getChar ( start + 1 ) != "x" and end = start + 2
144+ this .getChar ( start + 1 ) = "U" and end = start + 10
145+ or
146+ this .singleEscape ( start + 1 ) and end = start + 2
137147 )
138148 }
139149
You can’t perform that action at this time.
0 commit comments