Skip to content

Commit 694bb67

Browse files
committed
Make store step to send stmt's channel use post-update node
1 parent 06ac332 commit 694bb67

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

go/ql/lib/semmle/go/dataflow/internal/ContainerFlow.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ predicate containerStoreStep(Node node1, Node node2, Content c) {
3636
)
3737
or
3838
c instanceof CollectionContent and
39-
exists(SendStmt send |
40-
send.getChannel() = node2.(ExprNode).asExpr() and send.getValue() = node1.(ExprNode).asExpr()
39+
exists(SendStmt send, Node channelExprNode |
40+
send.getChannel() = channelExprNode.(ExprNode).asExpr() and
41+
node2.(PostUpdateNode).getPreUpdateNode() = channelExprNode and
42+
send.getValue() = node1.(ExprNode).asExpr()
4143
)
4244
or
4345
c instanceof MapKeyContent and

go/ql/test/library-tests/semmle/go/dataflow/ChannelField/test.expected

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
invalidModelRow
22
edges
33
| test.go:9:9:9:11 | selection of c [collection] | test.go:9:7:9:11 | <-... | provenance | |
4-
| test.go:13:16:13:16 | definition of s [pointer, c, collection] | test.go:16:2:16:2 | s [pointer, c, collection] | provenance | |
54
| test.go:15:10:15:17 | call to source | test.go:16:9:16:12 | data | provenance | |
6-
| test.go:16:2:16:2 | implicit dereference [c, collection] | test.go:13:16:13:16 | definition of s [pointer, c, collection] | provenance | |
7-
| test.go:16:2:16:2 | implicit dereference [c, collection] | test.go:16:2:16:4 | selection of c [collection] | provenance | |
8-
| test.go:16:2:16:2 | s [pointer, c, collection] | test.go:16:2:16:2 | implicit dereference [c, collection] | provenance | |
9-
| test.go:16:2:16:4 | selection of c [collection] | test.go:9:9:9:11 | selection of c [collection] | provenance | |
10-
| test.go:16:2:16:4 | selection of c [collection] | test.go:16:2:16:2 | implicit dereference [c, collection] | provenance | |
11-
| test.go:16:9:16:12 | data | test.go:16:2:16:4 | selection of c [collection] | provenance | |
5+
| test.go:16:2:16:4 | selection of c [postupdate] [collection] | test.go:9:9:9:11 | selection of c [collection] | provenance | |
6+
| test.go:16:9:16:12 | data | test.go:16:2:16:4 | selection of c [postupdate] [collection] | provenance | |
127
nodes
138
| test.go:9:7:9:11 | <-... | semmle.label | <-... |
149
| test.go:9:9:9:11 | selection of c [collection] | semmle.label | selection of c [collection] |
15-
| test.go:13:16:13:16 | definition of s [pointer, c, collection] | semmle.label | definition of s [pointer, c, collection] |
1610
| test.go:15:10:15:17 | call to source | semmle.label | call to source |
17-
| test.go:16:2:16:2 | implicit dereference [c, collection] | semmle.label | implicit dereference [c, collection] |
18-
| test.go:16:2:16:2 | s [pointer, c, collection] | semmle.label | s [pointer, c, collection] |
19-
| test.go:16:2:16:4 | selection of c [collection] | semmle.label | selection of c [collection] |
11+
| test.go:16:2:16:4 | selection of c [postupdate] [collection] | semmle.label | selection of c [postupdate] [collection] |
2012
| test.go:16:9:16:12 | data | semmle.label | data |
2113
subpaths
2214
#select

0 commit comments

Comments
 (0)