Skip to content

Commit 5439059

Browse files
committed
Python: Minor cleanup in regex.qll
1 parent 2e78077 commit 5439059

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

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

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,20 @@ private predicate re_module_function(string name, int flags) {
1919
predicate used_as_regex(Expr s, string mode) {
2020
(s instanceof Bytes or s instanceof Unicode)
2121
and
22-
exists(ModuleValue re | re = Module::named("re") |
23-
/* Call to re.xxx(regex, ... [mode]) */
24-
exists(CallNode call, string name |
25-
call.getArg(0).refersTo(_, _, s.getAFlowNode()) and
26-
call.getFunction().pointsTo(re.attr(name)) |
27-
mode = "None"
28-
or
29-
exists(Value obj |
30-
mode = mode_from_mode_object(obj) |
31-
exists(int flags_arg |
32-
re_module_function(name, flags_arg) and
33-
call.getArg(flags_arg).pointsTo(obj)
34-
)
35-
or
36-
call.getArgByName("flags").pointsTo(obj)
22+
/* Call to re.xxx(regex, ... [mode]) */
23+
exists(CallNode call, string name |
24+
call.getArg(0).refersTo(_, _, s.getAFlowNode()) and
25+
call.getFunction().pointsTo(Module::named("re").attr(name)) |
26+
mode = "None"
27+
or
28+
exists(Value obj |
29+
mode = mode_from_mode_object(obj) |
30+
exists(int flags_arg |
31+
re_module_function(name, flags_arg) and
32+
call.getArg(flags_arg).pointsTo(obj)
3733
)
34+
or
35+
call.getArgByName("flags").pointsTo(obj)
3836
)
3937
)
4038
}

0 commit comments

Comments
 (0)