Skip to content

Commit f9bff17

Browse files
committed
C#: Add missing assignment data flow steps
1 parent f8791c8 commit f9bff17

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ module LocalFlow {
111111
or
112112
// An `=` expression, where the result of the expression is used
113113
e2 = any(AssignExpr ae |
114-
ae.getParent() instanceof Expr and
114+
ae.getParent() = any(ControlFlowElement cfe | not cfe instanceof ExprStmt) and
115115
e1 = ae.getRValue()
116116
) and
117117
scope = e2 and

csharp/ql/test/library-tests/dataflow/local/DataFlowStep.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,8 @@
584584
| LocalDataFlow.cs:475:44:475:53 | nonTainted | LocalDataFlow.cs:477:15:477:24 | access to parameter nonTainted |
585585
| LocalDataFlow.cs:480:44:480:44 | x | LocalDataFlow.cs:483:21:483:21 | access to parameter x |
586586
| LocalDataFlow.cs:480:67:480:68 | os | LocalDataFlow.cs:486:32:486:33 | access to parameter os |
587+
| LocalDataFlow.cs:483:21:483:21 | access to parameter x | LocalDataFlow.cs:483:16:483:21 | ... = ... |
588+
| LocalDataFlow.cs:486:32:486:33 | access to parameter os | LocalDataFlow.cs:486:26:486:33 | ... = ... |
587589
| SSA.cs:5:17:5:17 | SSA entry def(this.S) | SSA.cs:67:9:67:14 | access to field S |
588590
| SSA.cs:5:17:5:17 | this | SSA.cs:67:9:67:12 | this access |
589591
| SSA.cs:5:26:5:32 | tainted | SSA.cs:8:24:8:30 | access to parameter tainted |

csharp/ql/test/library-tests/dataflow/local/TaintTrackingStep.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@
734734
| LocalDataFlow.cs:480:44:480:44 | x | LocalDataFlow.cs:483:21:483:21 | access to parameter x |
735735
| LocalDataFlow.cs:480:67:480:68 | os | LocalDataFlow.cs:480:67:480:68 | os |
736736
| LocalDataFlow.cs:480:67:480:68 | os | LocalDataFlow.cs:486:32:486:33 | access to parameter os |
737+
| LocalDataFlow.cs:483:21:483:21 | access to parameter x | LocalDataFlow.cs:483:16:483:21 | ... = ... |
738+
| LocalDataFlow.cs:486:32:486:33 | access to parameter os | LocalDataFlow.cs:486:26:486:33 | ... = ... |
737739
| SSA.cs:5:17:5:17 | SSA entry def(this.S) | SSA.cs:67:9:67:14 | access to field S |
738740
| SSA.cs:5:17:5:17 | this | SSA.cs:67:9:67:12 | this access |
739741
| SSA.cs:5:26:5:32 | tainted | SSA.cs:5:26:5:32 | tainted |

0 commit comments

Comments
 (0)