Skip to content

Commit 04341c4

Browse files
committed
Tweak model for str.join
1 parent b27d08e commit 04341c4

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

python/ql/lib/semmle/python/frameworks/Stdlib.qll

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4277,9 +4277,14 @@ module StdlibPrivate {
42774277
preservesValue = true
42784278
)
42794279
or
4280-
input = ["Argument[0]", "Argument[0].ListElement"] and
4281-
output = "ReturnValue" and
4282-
preservesValue = false
4280+
(
4281+
input = "Argument[0]" and
4282+
preservesValue = false
4283+
or
4284+
input = "Argument[0].ListElement" and
4285+
preservesValue = true
4286+
) and
4287+
output = "ReturnValue"
42834288
}
42844289
}
42854290

@@ -4985,9 +4990,16 @@ module StdlibPrivate {
49854990
}
49864991

49874992
override predicate propagatesFlow(string input, string output, boolean preservesValue) {
4988-
input = ["Argument[0,iterable:]", "Argument[0,iterable:].ListElement"] and
4989-
output = "ReturnValue" and
4990-
preservesValue = false
4993+
(
4994+
// For code like `" ".join([name])`
4995+
input = "Argument[0,iterable:].ListElement" and
4996+
preservesValue = true
4997+
or
4998+
// For code like `" ".join(name)`
4999+
input = "Argument[0,iterable:]" and
5000+
preservesValue = false
5001+
) and
5002+
output = "ReturnValue"
49915003
}
49925004
}
49935005

0 commit comments

Comments
 (0)