File tree Expand file tree Collapse file tree 4 files changed +53
-41
lines changed
python/ql/test/experimental/dataflow/variable-capture Expand file tree Collapse file tree 4 files changed +53
-41
lines changed Original file line number Diff line number Diff line change @@ -77,16 +77,18 @@ def m():
77
77
captureOut2 ()
78
78
SINK (sinkO2 ["x" ]) #$ MISSING:captured
79
79
80
- nonSink0 = { "x" : "" }
80
+ nonSink1 = { "x" : "" }
81
81
def captureOut1NotCalled ():
82
- nonSink0 ["x" ] = tainted
83
- SINK_F (nonSink0 ["x" ])
82
+ nonSink1 ["x" ] = tainted
83
+ SINK_F (nonSink1 ["x" ])
84
84
85
+ nonSink2 = { "x" : "" }
85
86
def captureOut2NotCalled ():
87
+ # notice that `m` is not called
86
88
def m ():
87
- nonSink0 ["x" ] = tainted
89
+ nonSink2 ["x" ] = tainted
88
90
captureOut2NotCalled ()
89
- SINK_F (nonSink0 ["x" ])
91
+ SINK_F (nonSink2 ["x" ])
90
92
91
93
@expects (4 )
92
94
def test_through ():
Original file line number Diff line number Diff line change @@ -34,7 +34,8 @@ def SINK_F(x):
34
34
35
35
sinkO1 = ""
36
36
sinkO2 = ""
37
- nonSink0 = ""
37
+ nonSink1 = ""
38
+ nonSink2 = ""
38
39
39
40
def out ():
40
41
def captureOut1 ():
@@ -52,24 +53,26 @@ def m():
52
53
SINK (sinkO2 ) #$ captured
53
54
54
55
def captureOut1NotCalled ():
55
- global nonSink0
56
- nonSink0 = SOURCE
57
- SINK_F (nonSink0 ) #$ SPURIOUS: captured
56
+ global nonSink1
57
+ nonSink1 = SOURCE
58
+ SINK_F (nonSink1 ) #$ SPURIOUS: captured
58
59
59
60
def captureOut2NotCalled ():
61
+ # notice that `m` is not called
60
62
def m ():
61
- global nonSink0
62
- nonSink0 = SOURCE
63
+ global nonSink2
64
+ nonSink2 = SOURCE
63
65
captureOut2NotCalled ()
64
- SINK_F (nonSink0 ) #$ SPURIOUS: captured
66
+ SINK_F (nonSink2 ) #$ SPURIOUS: captured
65
67
66
68
@expects (4 )
67
69
def test_out ():
68
70
out ()
69
71
70
72
sinkT1 = ""
71
73
sinkT2 = ""
72
- nonSinkT0 = ""
74
+ nonSinkT1 = ""
75
+ nonSinkT2 = ""
73
76
def through (tainted ):
74
77
def captureOut1 ():
75
78
global sinkT1
@@ -86,16 +89,17 @@ def m():
86
89
SINK (sinkT2 ) #$ MISSING:captured
87
90
88
91
def captureOut1NotCalled ():
89
- global nonSinkT0
90
- nonSinkT0 = tainted
91
- SINK_F (nonSinkT0 )
92
+ global nonSinkT1
93
+ nonSinkT1 = tainted
94
+ SINK_F (nonSinkT1 )
92
95
93
96
def captureOut2NotCalled ():
97
+ # notice that `m` is not called
94
98
def m ():
95
- global nonSinkT0
96
- nonSinkT0 = tainted
99
+ global nonSinkT2
100
+ nonSinkT2 = tainted
97
101
captureOut2NotCalled ()
98
- SINK_F (nonSinkT0 )
102
+ SINK_F (nonSinkT2 )
99
103
100
104
@expects (4 )
101
105
def test_through ():
Original file line number Diff line number Diff line change @@ -48,13 +48,14 @@ def m():
48
48
captureIn3 ("" )
49
49
50
50
def captureIn1NotCalled ():
51
- nonSink0 = tainted
52
- SINK_F (nonSink0 )
51
+ nonSink1 = tainted
52
+ SINK_F (nonSink1 )
53
53
54
54
def captureIn2NotCalled ():
55
+ # notice that `m` is not called
55
56
def m ():
56
- nonSink0 = tainted
57
- SINK_F (nonSink0 )
57
+ nonSink1 = tainted
58
+ SINK_F (nonSink1 )
58
59
captureIn2NotCalled ()
59
60
60
61
@expects (3 )
@@ -81,13 +82,14 @@ def m():
81
82
captureIn3 ("" )
82
83
83
84
def captureIn1NotCalled ():
84
- nonSink0 = tainted
85
- SINK_F (nonSink0 )
85
+ nonSink1 = tainted
86
+ SINK_F (nonSink1 )
86
87
87
88
def captureIn2NotCalled ():
89
+ # notice that `m` is not called
88
90
def m ():
89
- nonSink0 = tainted
90
- SINK_F (nonSink0 )
91
+ nonSink2 = tainted
92
+ SINK_F (nonSink2 )
91
93
captureIn2NotCalled ()
92
94
93
95
@expects (3 )
Original file line number Diff line number Diff line change @@ -49,18 +49,20 @@ def m():
49
49
captureOut2 ()
50
50
SINK (sinkO2 ) #$ MISSING:captured
51
51
52
- nonSink0 = ""
52
+ nonSink1 = ""
53
53
def captureOut1NotCalled ():
54
- nonlocal nonSink0
55
- nonSink0 = SOURCE
56
- SINK_F (nonSink0 )
54
+ nonlocal nonSink1
55
+ nonSink1 = SOURCE
56
+ SINK_F (nonSink1 )
57
57
58
+ nonSink2 = ""
58
59
def captureOut2NotCalled ():
60
+ # notice that `m` is not called
59
61
def m ():
60
- nonlocal nonSink0
61
- nonSink0 = SOURCE
62
+ nonlocal nonSink2
63
+ nonSink2 = SOURCE
62
64
captureOut2NotCalled ()
63
- SINK_F (nonSink0 )
65
+ SINK_F (nonSink2 )
64
66
65
67
@expects (4 )
66
68
def test_out ():
@@ -83,18 +85,20 @@ def m():
83
85
captureOut2 ()
84
86
SINK (sinkO2 ) #$ MISSING:captured
85
87
86
- nonSink0 = ""
88
+ nonSink1 = ""
87
89
def captureOut1NotCalled ():
88
- nonlocal nonSink0
89
- nonSink0 = tainted
90
- SINK_F (nonSink0 )
90
+ nonlocal nonSink1
91
+ nonSink1 = tainted
92
+ SINK_F (nonSink1 )
91
93
94
+ nonSink2 = ""
92
95
def captureOut2NotCalled ():
96
+ # notice that `m` is not called
93
97
def m ():
94
- nonlocal nonSink0
95
- nonSink0 = tainted
98
+ nonlocal nonSink2
99
+ nonSink2 = tainted
96
100
captureOut2NotCalled ()
97
- SINK_F (nonSink0 )
101
+ SINK_F (nonSink2 )
98
102
99
103
@expects (4 )
100
104
def test_through ():
You can’t perform that action at this time.
0 commit comments