Skip to content

Commit b2f9e09

Browse files
committed
ssa: Record ambiguousReadNode errors from VariableCapture
These consistency violations originate from the VariableCapture instantation in C#, JS, Python, and Ruby.
1 parent b1b2b20 commit b2f9e09

29 files changed

Lines changed: 352 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
ambiguousReadNode
2+
| Capture.cs:16:9:24:9 | CaptureIn2(...) | Capture.cs:7:10:7:11 | this in In |
3+
| Capture.cs:16:9:24:9 | CaptureIn2(...) | Capture.cs:7:20:7:26 | tainted |
4+
| Capture.cs:25:9:25:18 | access to local function CaptureIn2 | Capture.cs:7:10:7:11 | this in In |
5+
| Capture.cs:25:9:25:18 | access to local function CaptureIn2 | Capture.cs:7:20:7:26 | tainted |
6+
| Capture.cs:52:23:59:13 | (...) => ... | Capture.cs:50:33:50:40 | nonSink0 |
7+
| Capture.cs:52:23:59:13 | (...) => ... | Capture.cs:50:50:50:55 | sink39 |
8+
| Capture.cs:75:9:82:9 | CaptureOut2(...) | Capture.cs:64:10:64:12 | this in Out |
9+
| Capture.cs:75:9:82:9 | CaptureOut2(...) | Capture.cs:74:16:74:21 | sink31 |
10+
| Capture.cs:83:9:83:19 | access to local function CaptureOut2 | Capture.cs:64:10:64:12 | this in Out |
11+
| Capture.cs:83:9:83:19 | access to local function CaptureOut2 | Capture.cs:74:16:74:21 | sink31 |
12+
| Capture.cs:112:9:122:9 | CaptureOutMultipleLambdas(...) | Capture.cs:95:16:95:23 | nonSink0 |
13+
| Capture.cs:112:9:122:9 | CaptureOutMultipleLambdas(...) | Capture.cs:111:16:111:21 | sink40 |
14+
| Capture.cs:123:9:123:33 | access to local function CaptureOutMultipleLambdas | Capture.cs:95:16:95:23 | nonSink0 |
15+
| Capture.cs:123:9:123:33 | access to local function CaptureOutMultipleLambdas | Capture.cs:111:16:111:21 | sink40 |
16+
| Capture.cs:130:9:133:9 | CaptureThrough1(...) | Capture.cs:127:25:127:31 | tainted |
17+
| Capture.cs:130:9:133:9 | CaptureThrough1(...) | Capture.cs:129:16:129:21 | sink33 |
18+
| Capture.cs:134:9:134:23 | access to local function CaptureThrough1 | Capture.cs:127:25:127:31 | tainted |
19+
| Capture.cs:134:9:134:23 | access to local function CaptureThrough1 | Capture.cs:129:16:129:21 | sink33 |
20+
| Capture.cs:138:9:145:9 | CaptureThrough2(...) | Capture.cs:127:10:127:16 | this in Through |
21+
| Capture.cs:138:9:145:9 | CaptureThrough2(...) | Capture.cs:127:25:127:31 | tainted |
22+
| Capture.cs:138:9:145:9 | CaptureThrough2(...) | Capture.cs:137:16:137:21 | sink34 |
23+
| Capture.cs:146:9:146:23 | access to local function CaptureThrough2 | Capture.cs:127:10:127:16 | this in Through |
24+
| Capture.cs:146:9:146:23 | access to local function CaptureThrough2 | Capture.cs:127:25:127:31 | tainted |
25+
| Capture.cs:146:9:146:23 | access to local function CaptureThrough2 | Capture.cs:137:16:137:21 | sink34 |
26+
| Capture.cs:150:48:154:9 | (...) => ... | Capture.cs:127:25:127:31 | tainted |
27+
| Capture.cs:150:48:154:9 | (...) => ... | Capture.cs:149:16:149:21 | sink35 |
28+
| Capture.cs:155:30:155:44 | access to local variable captureThrough3 | Capture.cs:127:25:127:31 | tainted |
29+
| Capture.cs:155:30:155:44 | access to local variable captureThrough3 | Capture.cs:149:16:149:21 | sink35 |
30+
| Capture.cs:174:9:177:9 | CaptureThrough1NotCalled(...) | Capture.cs:127:25:127:31 | tainted |
31+
| Capture.cs:174:9:177:9 | CaptureThrough1NotCalled(...) | Capture.cs:173:16:173:23 | nonSink0 |
32+
| Capture.cs:180:9:186:9 | CaptureThrough2NotCalled(...) | Capture.cs:127:25:127:31 | tainted |
33+
| Capture.cs:180:9:186:9 | CaptureThrough2NotCalled(...) | Capture.cs:173:16:173:23 | nonSink0 |
34+
| Capture.cs:187:9:187:32 | access to local function CaptureThrough2NotCalled | Capture.cs:127:25:127:31 | tainted |
35+
| Capture.cs:187:9:187:32 | access to local function CaptureThrough2NotCalled | Capture.cs:173:16:173:23 | nonSink0 |
36+
| Capture.cs:332:9:332:65 | CapturingLocalFunction(...) | Capture.cs:326:10:326:12 | this in M12 |
37+
| Capture.cs:332:9:332:65 | CapturingLocalFunction(...) | Capture.cs:328:13:328:13 | x |
38+
| Capture.cs:334:9:334:30 | access to local function CapturingLocalFunction | Capture.cs:326:10:326:12 | this in M12 |
39+
| Capture.cs:334:9:334:30 | access to local function CapturingLocalFunction | Capture.cs:328:13:328:13 | x |
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
ambiguousReadNode
2+
| Capture.cs:15:9:22:9 | CapIn2(...) | Capture.cs:5:17:5:17 | this in M |
3+
| Capture.cs:15:9:22:9 | CapIn2(...) | Capture.cs:7:13:7:13 | i |
4+
| Capture.cs:23:9:23:14 | access to local function CapIn2 | Capture.cs:5:17:5:17 | this in M |
5+
| Capture.cs:23:9:23:14 | access to local function CapIn2 | Capture.cs:7:13:7:13 | i |
6+
| Capture.cs:25:9:33:9 | CapIn4(...) | Capture.cs:5:17:5:17 | this in M |
7+
| Capture.cs:25:9:33:9 | CapIn4(...) | Capture.cs:7:13:7:13 | i |
8+
| Capture.cs:34:9:34:14 | access to local function CapIn4 | Capture.cs:5:17:5:17 | this in M |
9+
| Capture.cs:34:9:34:14 | access to local function CapIn4 | Capture.cs:7:13:7:13 | i |
10+
| Capture.cs:43:9:50:9 | CapOut2(...) | Capture.cs:5:17:5:17 | this in M |
11+
| Capture.cs:43:9:50:9 | CapOut2(...) | Capture.cs:7:13:7:13 | i |
12+
| Capture.cs:51:9:51:15 | access to local function CapOut2 | Capture.cs:5:17:5:17 | this in M |
13+
| Capture.cs:51:9:51:15 | access to local function CapOut2 | Capture.cs:7:13:7:13 | i |
14+
| Capture.cs:54:9:62:9 | CapOut4(...) | Capture.cs:5:17:5:17 | this in M |
15+
| Capture.cs:54:9:62:9 | CapOut4(...) | Capture.cs:7:13:7:13 | i |
16+
| Capture.cs:63:9:63:15 | access to local function CapOut4 | Capture.cs:5:17:5:17 | this in M |
17+
| Capture.cs:63:9:63:15 | access to local function CapOut4 | Capture.cs:7:13:7:13 | i |
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
ambiguousReadNode
2+
| Capture.cs:10:20:27:9 | (...) => ... | Capture.cs:6:16:6:16 | i |
3+
| Capture.cs:10:20:27:9 | (...) => ... | Capture.cs:8:13:8:13 | x |
4+
| Capture.cs:19:24:23:13 | (...) => ... | Capture.cs:10:20:27:9 | this |
5+
| Capture.cs:19:24:23:13 | (...) => ... | Capture.cs:17:17:17:17 | y |
6+
| Capture.cs:25:13:25:13 | access to local variable b | Capture.cs:10:20:27:9 | this |
7+
| Capture.cs:25:13:25:13 | access to local variable b | Capture.cs:17:17:17:17 | y |
8+
| Capture.cs:38:9:38:9 | access to local variable a | Capture.cs:6:16:6:16 | i |
9+
| Capture.cs:38:9:38:9 | access to local variable a | Capture.cs:8:13:8:13 | x |
10+
| Capture.cs:46:12:46:12 | access to local variable a | Capture.cs:6:16:6:16 | i |
11+
| Capture.cs:46:12:46:12 | access to local variable a | Capture.cs:8:13:8:13 | x |
12+
| Capture.cs:169:9:178:9 | M8(...) | Capture.cs:112:10:112:28 | this in NestedFunctionsTest |
13+
| Capture.cs:169:9:178:9 | M8(...) | Capture.cs:168:13:168:13 | h |
14+
| Capture.cs:248:9:252:9 | CaptureAndRef(...) | Capture.cs:240:10:240:11 | this in M2 |
15+
| Capture.cs:248:9:252:9 | CaptureAndRef(...) | Capture.cs:242:13:242:13 | i |
16+
| Capture.cs:254:9:254:21 | access to local function CaptureAndRef | Capture.cs:240:10:240:11 | this in M2 |
17+
| Capture.cs:254:9:254:21 | access to local function CaptureAndRef | Capture.cs:242:13:242:13 | i |
18+
| Consistency.cs:39:20:39:43 | (...) => ... | Consistency.cs:36:10:36:27 | this in CapturedDeclNoInit |
19+
| Consistency.cs:39:20:39:43 | (...) => ... | Consistency.cs:38:13:38:13 | i |
20+
| Fields.cs:81:9:81:9 | access to local variable a | Fields.cs:77:13:77:13 | f |
21+
| Fields.cs:81:9:81:9 | access to local variable a | Fields.cs:78:23:78:23 | a |
22+
| Properties.cs:77:9:77:9 | access to local variable a | Properties.cs:73:13:73:13 | f |
23+
| Properties.cs:77:9:77:9 | access to local variable a | Properties.cs:74:23:74:23 | a |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ambiguousReadNode
2+
| ThreadUnsafeICryptoTransformLambda.cs:16:24:22:9 | (...) => ... | ThreadUnsafeICryptoTransformLambda.cs:10:32:10:34 | max |
3+
| ThreadUnsafeICryptoTransformLambda.cs:16:24:22:9 | (...) => ... | ThreadUnsafeICryptoTransformLambda.cs:15:13:15:16 | sha1 |
4+
| ThreadUnsafeICryptoTransformLambda.cs:80:24:86:9 | (...) => ... | ThreadUnsafeICryptoTransformLambda.cs:73:32:73:34 | max |
5+
| ThreadUnsafeICryptoTransformLambda.cs:80:24:86:9 | (...) => ... | ThreadUnsafeICryptoTransformLambda.cs:77:13:77:16 | sha1 |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ambiguousReadNode
2+
| A.cs:61:31:61:45 | (...) => ... | A.cs:61:26:61:26 | e |
3+
| A.cs:61:31:61:45 | (...) => ... | A.cs:61:26:61:45 | this |
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
ambiguousReadNode
2+
| SimplifyBoolExpr.cs:53:29:53:50 | (...) => ... | SimplifyBoolExpr.cs:50:65:50:68 | left |
3+
| SimplifyBoolExpr.cs:53:29:53:50 | (...) => ... | SimplifyBoolExpr.cs:50:100:50:104 | right |
4+
| SimplifyBoolExpr.cs:56:9:56:41 | Local(...) | SimplifyBoolExpr.cs:50:65:50:68 | left |
5+
| SimplifyBoolExpr.cs:56:9:56:41 | Local(...) | SimplifyBoolExpr.cs:50:100:50:104 | right |
6+
| SimplifyBoolExpr.cs:58:16:58:21 | access to local variable lambda | SimplifyBoolExpr.cs:50:65:50:68 | left |
7+
| SimplifyBoolExpr.cs:58:16:58:21 | access to local variable lambda | SimplifyBoolExpr.cs:50:100:50:104 | right |
8+
| SimplifyBoolExpr.cs:58:28:58:32 | access to local function Local | SimplifyBoolExpr.cs:50:65:50:68 | left |
9+
| SimplifyBoolExpr.cs:58:28:58:32 | access to local function Local | SimplifyBoolExpr.cs:50:100:50:104 | right |

‎javascript/ql/test/library-tests/FlowSummary/CaptureConsistency.expected‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ closureAliasMustBeInSameScope
1515
variableAccessAstNesting
1616
uniqueCallableLocation
1717
consistencyOverview
18+
ambiguousReadNode

‎python/ql/test/library-tests/dataflow/variable-capture/dataflow-capture-consistency.expected‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,32 @@ closureAliasMustBeInSameScope
1515
variableAccessAstNesting
1616
uniqueCallableLocation
1717
consistencyOverview
18+
ambiguousReadNode
19+
| dict.py:67:5:67:22 | ControlFlowNode for FunctionExpr | dict.py:65:1:65:21 | Local Variable sinkO1 |
20+
| dict.py:67:5:67:22 | ControlFlowNode for FunctionExpr | dict.py:65:1:65:21 | Local Variable tainted |
21+
| dict.py:69:5:69:15 | ControlFlowNode for captureOut1 | dict.py:65:1:65:21 | Local Variable sinkO1 |
22+
| dict.py:69:5:69:15 | ControlFlowNode for captureOut1 | dict.py:65:1:65:21 | Local Variable tainted |
23+
| dict.py:73:5:73:22 | ControlFlowNode for FunctionExpr | dict.py:65:1:65:21 | Local Variable sinkO2 |
24+
| dict.py:73:5:73:22 | ControlFlowNode for FunctionExpr | dict.py:65:1:65:21 | Local Variable tainted |
25+
| dict.py:77:5:77:15 | ControlFlowNode for captureOut2 | dict.py:65:1:65:21 | Local Variable sinkO2 |
26+
| dict.py:77:5:77:15 | ControlFlowNode for captureOut2 | dict.py:65:1:65:21 | Local Variable tainted |
27+
| dict.py:81:5:81:31 | ControlFlowNode for FunctionExpr | dict.py:65:1:65:21 | Local Variable nonSink1 |
28+
| dict.py:81:5:81:31 | ControlFlowNode for FunctionExpr | dict.py:65:1:65:21 | Local Variable tainted |
29+
| dict.py:86:5:86:31 | ControlFlowNode for FunctionExpr | dict.py:65:1:65:21 | Local Variable nonSink2 |
30+
| dict.py:86:5:86:31 | ControlFlowNode for FunctionExpr | dict.py:65:1:65:21 | Local Variable tainted |
31+
| dict.py:90:5:90:24 | ControlFlowNode for captureOut2NotCalled | dict.py:65:1:65:21 | Local Variable nonSink2 |
32+
| dict.py:90:5:90:24 | ControlFlowNode for captureOut2NotCalled | dict.py:65:1:65:21 | Local Variable tainted |
33+
| nonlocal.py:73:5:73:22 | ControlFlowNode for FunctionExpr | nonlocal.py:71:1:71:21 | Local Variable sinkO1 |
34+
| nonlocal.py:73:5:73:22 | ControlFlowNode for FunctionExpr | nonlocal.py:71:1:71:21 | Local Variable tainted |
35+
| nonlocal.py:76:5:76:15 | ControlFlowNode for captureOut1 | nonlocal.py:71:1:71:21 | Local Variable sinkO1 |
36+
| nonlocal.py:76:5:76:15 | ControlFlowNode for captureOut1 | nonlocal.py:71:1:71:21 | Local Variable tainted |
37+
| nonlocal.py:80:5:80:22 | ControlFlowNode for FunctionExpr | nonlocal.py:71:1:71:21 | Local Variable sinkO2 |
38+
| nonlocal.py:80:5:80:22 | ControlFlowNode for FunctionExpr | nonlocal.py:71:1:71:21 | Local Variable tainted |
39+
| nonlocal.py:85:5:85:15 | ControlFlowNode for captureOut2 | nonlocal.py:71:1:71:21 | Local Variable sinkO2 |
40+
| nonlocal.py:85:5:85:15 | ControlFlowNode for captureOut2 | nonlocal.py:71:1:71:21 | Local Variable tainted |
41+
| nonlocal.py:89:5:89:31 | ControlFlowNode for FunctionExpr | nonlocal.py:71:1:71:21 | Local Variable nonSink1 |
42+
| nonlocal.py:89:5:89:31 | ControlFlowNode for FunctionExpr | nonlocal.py:71:1:71:21 | Local Variable tainted |
43+
| nonlocal.py:95:5:95:31 | ControlFlowNode for FunctionExpr | nonlocal.py:71:1:71:21 | Local Variable nonSink2 |
44+
| nonlocal.py:95:5:95:31 | ControlFlowNode for FunctionExpr | nonlocal.py:71:1:71:21 | Local Variable tainted |
45+
| nonlocal.py:100:5:100:24 | ControlFlowNode for captureOut2NotCalled | nonlocal.py:71:1:71:21 | Local Variable nonSink2 |
46+
| nonlocal.py:100:5:100:24 | ControlFlowNode for captureOut2NotCalled | nonlocal.py:71:1:71:21 | Local Variable tainted |
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
ambiguousReadNode
2+
| calls/calls.rb:223:1:225:3 | { ... } | calls/calls.rb:1:1:367:24 | self |
3+
| calls/calls.rb:223:1:225:3 | { ... } | calls/calls.rb:223:5:223:5 | x |
4+
| calls/calls.rb:343:1:345:3 | { ... } | calls/calls.rb:1:1:367:24 | self |
5+
| calls/calls.rb:343:1:345:3 | { ... } | calls/calls.rb:223:5:223:5 | x |
6+
| calls/calls.rb:343:1:345:3 | { ... } | calls/calls.rb:343:8:343:8 | y |
7+
| calls/calls.rb:343:1:345:3 | { ... } | calls/calls.rb:343:11:343:11 | z |
8+
| calls/calls.rb:357:1:361:3 | ... = ... | calls/calls.rb:1:1:367:24 | self |
9+
| calls/calls.rb:357:1:361:3 | ... = ... | calls/calls.rb:343:8:343:8 | y |
10+
| calls/calls.rb:357:5:361:3 | -> { ... } | calls/calls.rb:1:1:367:24 | self |
11+
| calls/calls.rb:357:5:361:3 | -> { ... } | calls/calls.rb:343:8:343:8 | y |
12+
| control/loops.rb:9:1:12:3 | { ... } | control/loops.rb:2:1:2:3 | foo |
13+
| control/loops.rb:9:1:12:3 | { ... } | control/loops.rb:3:1:3:3 | sum |
14+
| control/loops.rb:9:1:12:3 | { ... } | control/loops.rb:9:5:9:5 | n |
15+
| control/loops.rb:16:1:19:3 | { ... } | control/loops.rb:2:1:2:3 | foo |
16+
| control/loops.rb:16:1:19:3 | { ... } | control/loops.rb:3:1:3:3 | sum |
17+
| control/loops.rb:16:1:19:3 | { ... } | control/loops.rb:9:5:9:5 | n |
18+
| control/loops.rb:22:1:25:3 | { ... } | control/loops.rb:2:1:2:3 | foo |
19+
| control/loops.rb:22:1:25:3 | { ... } | control/loops.rb:3:1:3:3 | sum |
20+
| control/loops.rb:22:1:25:3 | { ... } | control/loops.rb:22:5:22:7 | key |
21+
| control/loops.rb:22:1:25:3 | { ... } | control/loops.rb:22:10:22:14 | value |
22+
| control/loops.rb:28:1:32:3 | { ... } | control/loops.rb:2:1:2:3 | foo |
23+
| control/loops.rb:28:1:32:3 | { ... } | control/loops.rb:3:1:3:3 | sum |
24+
| control/loops.rb:28:1:32:3 | { ... } | control/loops.rb:22:5:22:7 | key |
25+
| control/loops.rb:28:1:32:3 | { ... } | control/loops.rb:22:10:22:14 | value |
26+
| erb/template.html.erb:27:6:31:8 | { ... } | erb/template.html.erb:25:4:25:5 | xs |
27+
| erb/template.html.erb:27:6:31:8 | { ... } | erb/template.html.erb:27:10:27:10 | x |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ambiguousReadNode
2+
| calls.rb:223:1:225:3 | { ... } | calls.rb:1:1:367:24 | self |
3+
| calls.rb:223:1:225:3 | { ... } | calls.rb:223:5:223:5 | x |
4+
| calls.rb:343:1:345:3 | { ... } | calls.rb:1:1:367:24 | self |
5+
| calls.rb:343:1:345:3 | { ... } | calls.rb:223:5:223:5 | x |
6+
| calls.rb:343:1:345:3 | { ... } | calls.rb:343:8:343:8 | y |
7+
| calls.rb:343:1:345:3 | { ... } | calls.rb:343:11:343:11 | z |
8+
| calls.rb:357:1:361:3 | ... = ... | calls.rb:1:1:367:24 | self |
9+
| calls.rb:357:1:361:3 | ... = ... | calls.rb:343:8:343:8 | y |
10+
| calls.rb:357:5:361:3 | -> { ... } | calls.rb:1:1:367:24 | self |
11+
| calls.rb:357:5:361:3 | -> { ... } | calls.rb:343:8:343:8 | y |

0 commit comments

Comments
 (0)