diff --git a/go/ql/lib/semmle/go/dataflow/internal/ContainerFlow.qll b/go/ql/lib/semmle/go/dataflow/internal/ContainerFlow.qll index 9f07693b7ea..8a17ed1a78f 100644 --- a/go/ql/lib/semmle/go/dataflow/internal/ContainerFlow.qll +++ b/go/ql/lib/semmle/go/dataflow/internal/ContainerFlow.qll @@ -36,8 +36,10 @@ predicate containerStoreStep(Node node1, Node node2, Content c) { ) or c instanceof CollectionContent and - exists(SendStmt send | - send.getChannel() = node2.(ExprNode).asExpr() and send.getValue() = node1.(ExprNode).asExpr() + exists(SendStmt send, Node channelExprNode | + send.getChannel() = channelExprNode.(ExprNode).asExpr() and + node2.(PostUpdateNode).getPreUpdateNode() = channelExprNode and + send.getValue() = node1.(ExprNode).asExpr() ) or c instanceof MapKeyContent and diff --git a/go/ql/test/library-tests/semmle/go/dataflow/ChannelField/test.expected b/go/ql/test/library-tests/semmle/go/dataflow/ChannelField/test.expected index 547c7b25da1..6936b333cf1 100644 --- a/go/ql/test/library-tests/semmle/go/dataflow/ChannelField/test.expected +++ b/go/ql/test/library-tests/semmle/go/dataflow/ChannelField/test.expected @@ -1,22 +1,14 @@ invalidModelRow edges | test.go:9:9:9:11 | selection of c [collection] | test.go:9:7:9:11 | <-... | provenance | | -| test.go:13:16:13:16 | definition of s [pointer, c, collection] | test.go:16:2:16:2 | s [pointer, c, collection] | provenance | | | test.go:15:10:15:17 | call to source | test.go:16:9:16:12 | data | provenance | | -| test.go:16:2:16:2 | implicit dereference [c, collection] | test.go:13:16:13:16 | definition of s [pointer, c, collection] | provenance | | -| test.go:16:2:16:2 | implicit dereference [c, collection] | test.go:16:2:16:4 | selection of c [collection] | provenance | | -| test.go:16:2:16:2 | s [pointer, c, collection] | test.go:16:2:16:2 | implicit dereference [c, collection] | provenance | | -| test.go:16:2:16:4 | selection of c [collection] | test.go:9:9:9:11 | selection of c [collection] | provenance | | -| test.go:16:2:16:4 | selection of c [collection] | test.go:16:2:16:2 | implicit dereference [c, collection] | provenance | | -| test.go:16:9:16:12 | data | test.go:16:2:16:4 | selection of c [collection] | provenance | | +| test.go:16:2:16:4 | selection of c [postupdate] [collection] | test.go:9:9:9:11 | selection of c [collection] | provenance | | +| test.go:16:9:16:12 | data | test.go:16:2:16:4 | selection of c [postupdate] [collection] | provenance | | nodes | test.go:9:7:9:11 | <-... | semmle.label | <-... | | test.go:9:9:9:11 | selection of c [collection] | semmle.label | selection of c [collection] | -| test.go:13:16:13:16 | definition of s [pointer, c, collection] | semmle.label | definition of s [pointer, c, collection] | | test.go:15:10:15:17 | call to source | semmle.label | call to source | -| test.go:16:2:16:2 | implicit dereference [c, collection] | semmle.label | implicit dereference [c, collection] | -| test.go:16:2:16:2 | s [pointer, c, collection] | semmle.label | s [pointer, c, collection] | -| test.go:16:2:16:4 | selection of c [collection] | semmle.label | selection of c [collection] | +| test.go:16:2:16:4 | selection of c [postupdate] [collection] | semmle.label | selection of c [postupdate] [collection] | | test.go:16:9:16:12 | data | semmle.label | data | subpaths #select