Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2a55ba5

Browse files
author
Max Schaefer
committed
JavaScript: Fix join order in PathNode.getASuccessor.
1 parent f6029bd commit 2a55ba5

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

javascript/ql/src/semmle/javascript/dataflow/Configuration.qll

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,18 @@ private MidPathNode finalMidNode(SinkPathNode snk) {
10701070
)
10711071
}
10721072

1073+
/**
1074+
* Holds if `nd` is a mid node wrapping `(predNd, cfg, summary)`, and there is a flow step
1075+
* from `predNd` to `succNd` under `cfg` with summary `newSummary`.
1076+
*
1077+
* This helper predicate exists to clarify the intended join order in `getASuccessor` below.
1078+
*/
1079+
pragma[noinline]
1080+
private predicate midNodeStep(PathNode nd, DataFlow::Node predNd, Configuration cfg, PathSummary summary, DataFlow::Node succNd, PathSummary newSummary) {
1081+
nd = MkMidNode(predNd, cfg, summary) and
1082+
flowStep(predNd, id(cfg), succNd, newSummary)
1083+
}
1084+
10731085
/**
10741086
* Gets a node to which data from `nd` may flow in one step.
10751087
*/
@@ -1079,8 +1091,7 @@ private PathNode getASuccessor(PathNode nd) {
10791091
or
10801092
// mid node to mid node
10811093
exists(Configuration cfg, DataFlow::Node predNd, PathSummary summary, DataFlow::Node succNd, PathSummary newSummary |
1082-
nd = MkMidNode(predNd, cfg, summary) and
1083-
flowStep(predNd, id(cfg), succNd, newSummary) and
1094+
midNodeStep(nd, predNd, cfg, summary, succNd, newSummary) and
10841095
result = MkMidNode(succNd, id(cfg), summary.append(newSummary))
10851096
)
10861097
or

0 commit comments

Comments
 (0)