@@ -23,41 +23,24 @@ class UnicodeCompatibilityNormalize extends API::CallNode {
23
23
int argIdx ;
24
24
25
25
UnicodeCompatibilityNormalize ( ) {
26
- exists ( API:: CallNode cn , DataFlow:: Node form |
27
- cn = API:: moduleImport ( "unicodedata" ) .getMember ( "normalize" ) .getACall ( ) and
28
- form .asExpr ( ) .( StrConst ) .getS ( ) in [ "NFKC" , "NFKD" ] and
29
- TaintTracking:: localTaint ( form , cn .getArg ( 0 ) ) and
30
- this = cn and
31
- argIdx = 1
32
- )
26
+ (
27
+ this = API:: moduleImport ( "unicodedata" ) .getMember ( "normalize" ) .getACall ( ) and
28
+ this .getParameter ( 0 ) .getAValueReachingSink ( ) .asExpr ( ) .( StrConst ) .getText ( ) in [ "NFKC" , "NFKD" ]
29
+ or
30
+ this = API:: moduleImport ( "pyunormalize" ) .getMember ( "normalize" ) .getACall ( ) and
31
+ this .getParameter ( 0 ) .getAValueReachingSink ( ) .asExpr ( ) .( StrConst ) .getText ( ) in [ "NFKC" , "NFKD" ]
32
+ ) and
33
+ argIdx = 1
33
34
or
34
- exists ( API:: CallNode cn |
35
- cn = API:: moduleImport ( "unidecode" ) .getMember ( "unidecode" ) .getACall ( ) and
36
- this = cn and
37
- argIdx = 0
38
- )
39
- or
40
- exists ( API:: CallNode cn |
41
- cn = API:: moduleImport ( "pyunormalize" ) .getMember ( [ "NFKC" , "NFKD" ] ) .getACall ( ) and
42
- this = cn and
43
- argIdx = 0
44
- )
45
- or
46
- exists ( API:: CallNode cn , DataFlow:: Node form |
47
- cn = API:: moduleImport ( "pyunormalize" ) .getMember ( "normalize" ) .getACall ( ) and
48
- form .asExpr ( ) .( StrConst ) .getS ( ) in [ "NFKC" , "NFKD" ] and
49
- TaintTracking:: localTaint ( form , cn .getArg ( 0 ) ) and
50
- this = cn and
51
- argIdx = 1
52
- )
53
- or
54
- exists ( API:: CallNode cn , DataFlow:: Node form |
55
- cn = API:: moduleImport ( "textnorm" ) .getMember ( "normalize_unicode" ) .getACall ( ) and
56
- form .asExpr ( ) .( StrConst ) .getS ( ) in [ "NFKC" , "NFKD" ] and
57
- TaintTracking:: localTaint ( form , cn .getArg ( 1 ) ) and
58
- this = cn and
59
- argIdx = 0
60
- )
35
+ (
36
+ this = API:: moduleImport ( "textnorm" ) .getMember ( "normalize_unicode" ) .getACall ( ) and
37
+ this .getParameter ( 1 ) .getAValueReachingSink ( ) .asExpr ( ) .( StrConst ) .getText ( ) in [ "NFKC" , "NFKD" ]
38
+ or
39
+ this = API:: moduleImport ( "unidecode" ) .getMember ( "unidecode" ) .getACall ( )
40
+ or
41
+ this = API:: moduleImport ( "pyunormalize" ) .getMember ( [ "NFKC" , "NFKD" ] ) .getACall ( )
42
+ ) and
43
+ argIdx = 0
61
44
}
62
45
63
46
DataFlow:: Node getPathArg ( ) { result = this .getArg ( argIdx ) }
@@ -73,7 +56,7 @@ predicate underAValue(DataFlow::GuardNode g, ControlFlowNode node, boolean branc
73
56
branch = true and
74
57
cn .operands ( n .asCfgNode ( ) , op_lt , _)
75
58
or
76
- // LIMIT >= arg OR LIMIT > arg
59
+ // LIMIT >= arg OR LIMIT > arg
77
60
( op_gt = any ( GtE gte ) or op_gt = any ( Gt gt ) ) and
78
61
branch = true and
79
62
cn .operands ( _, op_gt , n .asCfgNode ( ) )
0 commit comments