Skip to content

Commit 0afa13a

Browse files
committed
Shared: Fix bad join.
1 parent 20d9fd1 commit 0afa13a

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

shared/dataflow/codeql/dataflow/internal/ContentDataFlowImpl.qll

+23-8
Original file line numberDiff line numberDiff line change
@@ -455,27 +455,42 @@ module MakeImplContentDataFlow<LocationSig Location, InputSig<Location> Lang> {
455455
)
456456
}
457457

458+
pragma[nomagic]
459+
private predicate nodeAndState(Flow::PathNode n, Node node, State state) {
460+
n.getNode() = node and n.getState() = state
461+
}
462+
463+
pragma[nomagic]
464+
private predicate succNodeAndState(
465+
Flow::PathNode pre, Node preNode, State preState, Flow::PathNode succ, Node succNode,
466+
State succState
467+
) {
468+
nodeAndState(pre, preNode, preState) and
469+
nodeAndState(succ, succNode, succState) and
470+
pre.getASuccessor() = succ
471+
}
472+
458473
pragma[nomagic]
459474
private predicate nodeReachesStore(
460-
Flow::PathNode source, AccessPath scReads, AccessPath scStores, Flow::PathNode node,
475+
Flow::PathNode source, AccessPath scReads, AccessPath scStores, Flow::PathNode target,
461476
ContentSet c, AccessPath reads, AccessPath stores
462477
) {
463-
exists(Flow::PathNode mid |
478+
exists(Flow::PathNode mid, State midState, Node midNode, State targetState, Node targetNode |
464479
nodeReaches(source, scReads, scStores, mid, reads, stores) and
465-
storeStep(mid.getNode(), mid.getState(), c, node.getNode(), node.getState()) and
466-
mid.getASuccessor() = node
480+
succNodeAndState(mid, midNode, midState, target, targetNode, targetState) and
481+
storeStep(midNode, midState, c, targetNode, targetState)
467482
)
468483
}
469484

470485
pragma[nomagic]
471486
private predicate nodeReachesRead(
472-
Flow::PathNode source, AccessPath scReads, AccessPath scStores, Flow::PathNode node,
487+
Flow::PathNode source, AccessPath scReads, AccessPath scStores, Flow::PathNode target,
473488
ContentSet c, AccessPath reads, AccessPath stores
474489
) {
475-
exists(Flow::PathNode mid |
490+
exists(Flow::PathNode mid, State midState, Node midNode, State targetState, Node targetNode |
476491
nodeReaches(source, scReads, scStores, mid, reads, stores) and
477-
readStep(mid.getNode(), mid.getState(), c, node.getNode(), node.getState()) and
478-
mid.getASuccessor() = node
492+
succNodeAndState(mid, midNode, midState, target, targetNode, targetState) and
493+
readStep(midNode, midState, c, targetNode, targetState)
479494
)
480495
}
481496

0 commit comments

Comments
 (0)