Skip to content

Commit 9016997

Browse files
committed
Golang: fix flow from a map value via a range statement
1 parent c87b7b5 commit 9016997

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ predicate containerStoreStep(Node node1, Node node2, Content c) {
5757
predicate containerReadStep(Node node1, Node node2, Content c) {
5858
c instanceof ArrayContent and
5959
(
60-
node2.(Read).readsElement(node1, _) and
61-
(
62-
node1.getType() instanceof ArrayType or
63-
node1.getType() instanceof SliceType
64-
)
60+
node1.getType() instanceof ArrayType or
61+
node1.getType() instanceof SliceType
62+
) and
63+
(
64+
node2.(Read).readsElement(node1, _)
6565
or
6666
node2.(RangeElementNode).getBase() = node1
6767
or
@@ -85,5 +85,5 @@ predicate containerReadStep(Node node1, Node node2, Content c) {
8585
or
8686
c instanceof MapValueContent and
8787
node1.getType() instanceof MapType and
88-
node2.(Read).readsElement(node1, _)
88+
(node2.(Read).readsElement(node1, _) or node2.(RangeElementNode).getBase() = node1)
8989
}

0 commit comments

Comments
 (0)