Skip to content

Commit 39531c6

Browse files
authored
Merge pull request #2574 from max-schaefer/js/fix-17
Approved by erik-krogh
2 parents 48deb30 + de02bb4 commit 39531c6

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -938,8 +938,8 @@ private predicate onPath(DataFlow::Node nd, DataFlow::Configuration cfg, PathSum
938938
or
939939
exists(DataFlow::Node mid, PathSummary stepSummary |
940940
reachableFromSource(nd, cfg, summary) and
941-
flowStep(nd, cfg, mid, stepSummary) and
942-
onPath(mid, cfg, summary.append(stepSummary))
941+
flowStep(nd, id(cfg), mid, stepSummary) and
942+
onPath(mid, id(cfg), summary.append(stepSummary))
943943
)
944944
}
945945

@@ -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)