Skip to content

Commit 2b2ac06

Browse files
committed
Data flow: Sync files
1 parent bd9b656 commit 2b2ac06

File tree

5 files changed

+110
-75
lines changed

5 files changed

+110
-75
lines changed

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -789,24 +789,31 @@ private module Cached {
789789
cached
790790
predicate readSet(Node node1, ContentSet c, Node node2) { readStep(node1, c, node2) }
791791

792+
cached
793+
predicate storeSet(
794+
Node node1, ContentSet c, Node node2, DataFlowType contentType, DataFlowType containerType
795+
) {
796+
storeStep(node1, c, node2) and
797+
contentType = getNodeDataFlowType(node1) and
798+
containerType = getNodeDataFlowType(node2)
799+
or
800+
exists(Node n1, Node n2 |
801+
n1 = node1.(PostUpdateNode).getPreUpdateNode() and
802+
n2 = node2.(PostUpdateNode).getPreUpdateNode()
803+
|
804+
argumentValueFlowsThrough(n2, TReadStepTypesSome(containerType, c, contentType), n1)
805+
or
806+
readSet(n2, c, n1) and
807+
contentType = getNodeDataFlowType(n1) and
808+
containerType = getNodeDataFlowType(n2)
809+
)
810+
}
811+
792812
private predicate store(
793813
Node node1, Content c, Node node2, DataFlowType contentType, DataFlowType containerType
794814
) {
795-
exists(ContentSet cs | c = cs.getAStoreContent() |
796-
storeStep(node1, cs, node2) and
797-
contentType = getNodeDataFlowType(node1) and
798-
containerType = getNodeDataFlowType(node2)
799-
or
800-
exists(Node n1, Node n2 |
801-
n1 = node1.(PostUpdateNode).getPreUpdateNode() and
802-
n2 = node2.(PostUpdateNode).getPreUpdateNode()
803-
|
804-
argumentValueFlowsThrough(n2, TReadStepTypesSome(containerType, cs, contentType), n1)
805-
or
806-
readSet(n2, cs, n1) and
807-
contentType = getNodeDataFlowType(n1) and
808-
containerType = getNodeDataFlowType(n2)
809-
)
815+
exists(ContentSet cs |
816+
c = cs.getAStoreContent() and storeSet(node1, cs, node2, contentType, containerType)
810817
)
811818
}
812819

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -789,24 +789,31 @@ private module Cached {
789789
cached
790790
predicate readSet(Node node1, ContentSet c, Node node2) { readStep(node1, c, node2) }
791791

792+
cached
793+
predicate storeSet(
794+
Node node1, ContentSet c, Node node2, DataFlowType contentType, DataFlowType containerType
795+
) {
796+
storeStep(node1, c, node2) and
797+
contentType = getNodeDataFlowType(node1) and
798+
containerType = getNodeDataFlowType(node2)
799+
or
800+
exists(Node n1, Node n2 |
801+
n1 = node1.(PostUpdateNode).getPreUpdateNode() and
802+
n2 = node2.(PostUpdateNode).getPreUpdateNode()
803+
|
804+
argumentValueFlowsThrough(n2, TReadStepTypesSome(containerType, c, contentType), n1)
805+
or
806+
readSet(n2, c, n1) and
807+
contentType = getNodeDataFlowType(n1) and
808+
containerType = getNodeDataFlowType(n2)
809+
)
810+
}
811+
792812
private predicate store(
793813
Node node1, Content c, Node node2, DataFlowType contentType, DataFlowType containerType
794814
) {
795-
exists(ContentSet cs | c = cs.getAStoreContent() |
796-
storeStep(node1, cs, node2) and
797-
contentType = getNodeDataFlowType(node1) and
798-
containerType = getNodeDataFlowType(node2)
799-
or
800-
exists(Node n1, Node n2 |
801-
n1 = node1.(PostUpdateNode).getPreUpdateNode() and
802-
n2 = node2.(PostUpdateNode).getPreUpdateNode()
803-
|
804-
argumentValueFlowsThrough(n2, TReadStepTypesSome(containerType, cs, contentType), n1)
805-
or
806-
readSet(n2, cs, n1) and
807-
contentType = getNodeDataFlowType(n1) and
808-
containerType = getNodeDataFlowType(n2)
809-
)
815+
exists(ContentSet cs |
816+
c = cs.getAStoreContent() and storeSet(node1, cs, node2, contentType, containerType)
810817
)
811818
}
812819

java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -789,24 +789,31 @@ private module Cached {
789789
cached
790790
predicate readSet(Node node1, ContentSet c, Node node2) { readStep(node1, c, node2) }
791791

792+
cached
793+
predicate storeSet(
794+
Node node1, ContentSet c, Node node2, DataFlowType contentType, DataFlowType containerType
795+
) {
796+
storeStep(node1, c, node2) and
797+
contentType = getNodeDataFlowType(node1) and
798+
containerType = getNodeDataFlowType(node2)
799+
or
800+
exists(Node n1, Node n2 |
801+
n1 = node1.(PostUpdateNode).getPreUpdateNode() and
802+
n2 = node2.(PostUpdateNode).getPreUpdateNode()
803+
|
804+
argumentValueFlowsThrough(n2, TReadStepTypesSome(containerType, c, contentType), n1)
805+
or
806+
readSet(n2, c, n1) and
807+
contentType = getNodeDataFlowType(n1) and
808+
containerType = getNodeDataFlowType(n2)
809+
)
810+
}
811+
792812
private predicate store(
793813
Node node1, Content c, Node node2, DataFlowType contentType, DataFlowType containerType
794814
) {
795-
exists(ContentSet cs | c = cs.getAStoreContent() |
796-
storeStep(node1, cs, node2) and
797-
contentType = getNodeDataFlowType(node1) and
798-
containerType = getNodeDataFlowType(node2)
799-
or
800-
exists(Node n1, Node n2 |
801-
n1 = node1.(PostUpdateNode).getPreUpdateNode() and
802-
n2 = node2.(PostUpdateNode).getPreUpdateNode()
803-
|
804-
argumentValueFlowsThrough(n2, TReadStepTypesSome(containerType, cs, contentType), n1)
805-
or
806-
readSet(n2, cs, n1) and
807-
contentType = getNodeDataFlowType(n1) and
808-
containerType = getNodeDataFlowType(n2)
809-
)
815+
exists(ContentSet cs |
816+
c = cs.getAStoreContent() and storeSet(node1, cs, node2, contentType, containerType)
810817
)
811818
}
812819

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplCommon.qll

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -789,24 +789,31 @@ private module Cached {
789789
cached
790790
predicate readSet(Node node1, ContentSet c, Node node2) { readStep(node1, c, node2) }
791791

792+
cached
793+
predicate storeSet(
794+
Node node1, ContentSet c, Node node2, DataFlowType contentType, DataFlowType containerType
795+
) {
796+
storeStep(node1, c, node2) and
797+
contentType = getNodeDataFlowType(node1) and
798+
containerType = getNodeDataFlowType(node2)
799+
or
800+
exists(Node n1, Node n2 |
801+
n1 = node1.(PostUpdateNode).getPreUpdateNode() and
802+
n2 = node2.(PostUpdateNode).getPreUpdateNode()
803+
|
804+
argumentValueFlowsThrough(n2, TReadStepTypesSome(containerType, c, contentType), n1)
805+
or
806+
readSet(n2, c, n1) and
807+
contentType = getNodeDataFlowType(n1) and
808+
containerType = getNodeDataFlowType(n2)
809+
)
810+
}
811+
792812
private predicate store(
793813
Node node1, Content c, Node node2, DataFlowType contentType, DataFlowType containerType
794814
) {
795-
exists(ContentSet cs | c = cs.getAStoreContent() |
796-
storeStep(node1, cs, node2) and
797-
contentType = getNodeDataFlowType(node1) and
798-
containerType = getNodeDataFlowType(node2)
799-
or
800-
exists(Node n1, Node n2 |
801-
n1 = node1.(PostUpdateNode).getPreUpdateNode() and
802-
n2 = node2.(PostUpdateNode).getPreUpdateNode()
803-
|
804-
argumentValueFlowsThrough(n2, TReadStepTypesSome(containerType, cs, contentType), n1)
805-
or
806-
readSet(n2, cs, n1) and
807-
contentType = getNodeDataFlowType(n1) and
808-
containerType = getNodeDataFlowType(n2)
809-
)
815+
exists(ContentSet cs |
816+
c = cs.getAStoreContent() and storeSet(node1, cs, node2, contentType, containerType)
810817
)
811818
}
812819

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -789,24 +789,31 @@ private module Cached {
789789
cached
790790
predicate readSet(Node node1, ContentSet c, Node node2) { readStep(node1, c, node2) }
791791

792+
cached
793+
predicate storeSet(
794+
Node node1, ContentSet c, Node node2, DataFlowType contentType, DataFlowType containerType
795+
) {
796+
storeStep(node1, c, node2) and
797+
contentType = getNodeDataFlowType(node1) and
798+
containerType = getNodeDataFlowType(node2)
799+
or
800+
exists(Node n1, Node n2 |
801+
n1 = node1.(PostUpdateNode).getPreUpdateNode() and
802+
n2 = node2.(PostUpdateNode).getPreUpdateNode()
803+
|
804+
argumentValueFlowsThrough(n2, TReadStepTypesSome(containerType, c, contentType), n1)
805+
or
806+
readSet(n2, c, n1) and
807+
contentType = getNodeDataFlowType(n1) and
808+
containerType = getNodeDataFlowType(n2)
809+
)
810+
}
811+
792812
private predicate store(
793813
Node node1, Content c, Node node2, DataFlowType contentType, DataFlowType containerType
794814
) {
795-
exists(ContentSet cs | c = cs.getAStoreContent() |
796-
storeStep(node1, cs, node2) and
797-
contentType = getNodeDataFlowType(node1) and
798-
containerType = getNodeDataFlowType(node2)
799-
or
800-
exists(Node n1, Node n2 |
801-
n1 = node1.(PostUpdateNode).getPreUpdateNode() and
802-
n2 = node2.(PostUpdateNode).getPreUpdateNode()
803-
|
804-
argumentValueFlowsThrough(n2, TReadStepTypesSome(containerType, cs, contentType), n1)
805-
or
806-
readSet(n2, cs, n1) and
807-
contentType = getNodeDataFlowType(n1) and
808-
containerType = getNodeDataFlowType(n2)
809-
)
815+
exists(ContentSet cs |
816+
c = cs.getAStoreContent() and storeSet(node1, cs, node2, contentType, containerType)
810817
)
811818
}
812819

0 commit comments

Comments
 (0)