mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Merge pull request #4245 from RasmusWL/python-dataflow-dynamic-tuple-tests
Python: Add dataflow tests for dynamic tuple creation
This commit is contained in:
@@ -534,3 +534,40 @@ def test_deep_callgraph():
|
||||
|
||||
x = f6(SOURCE)
|
||||
SINK(x) # Flow missing
|
||||
|
||||
|
||||
def test_dynamic_tuple_creation_1():
|
||||
tup = tuple()
|
||||
tup += (SOURCE,)
|
||||
tup += (NONSOURCE,)
|
||||
|
||||
SINK(tup[0]) # Flow missing
|
||||
SINK_F(tup[1])
|
||||
|
||||
|
||||
def test_dynamic_tuple_creation_2():
|
||||
tup = ()
|
||||
tup += (SOURCE,)
|
||||
tup += (NONSOURCE,)
|
||||
|
||||
SINK(tup[0]) # Flow missing
|
||||
SINK_F(tup[1])
|
||||
|
||||
|
||||
def test_dynamic_tuple_creation_3():
|
||||
tup1 = (SOURCE,)
|
||||
tup2 = (NONSOURCE,)
|
||||
tup = tup1 + tup2
|
||||
|
||||
SINK(tup[0]) # Flow missing
|
||||
SINK_F(tup[1])
|
||||
|
||||
|
||||
# Inspired by FP-report https://github.com/github/codeql/issues/4239
|
||||
def test_dynamic_tuple_creation_4():
|
||||
tup = ()
|
||||
for item in [SOURCE, NONSOURCE]:
|
||||
tup += (item,)
|
||||
|
||||
SINK(tup[0]) # Flow missing
|
||||
SINK_F(tup[1])
|
||||
|
||||
Reference in New Issue
Block a user