Skip to content

Commit 7a3b8eb

Browse files
committed
Address review comments
1 parent 40089e8 commit 7a3b8eb

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
category: minorAnalysis
33
---
4-
* Path explanations now include flow that goes through callbacks passed into library functions. For example, if `map` is library function, then in `result = map(xs, x => x + 1)` we will now include the step from `x` to `x + 1` in the path explanation, instead og going directly from `xs` to `result`. Note that this change does not affect actual query results, but only how path explanations are computed.
4+
* Path explanations now include flow that goes through callbacks passed into library functions. For example, if `map` is a library function, then in `result = map(xs, x => x + 1)` we will now include the step from `x` to `x + 1` in the path explanation, instead og going directly from `xs` to `result`. Note that this change does not affect actual query results, but only how path explanations are computed.

shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4356,14 +4356,14 @@ module MakeImpl<InputSig Lang> {
43564356
)
43574357
}
43584358

4359-
private PathNodeImpl localStepToHidden(PathNodeImpl n) {
4360-
result = localStep(n) and
4361-
result.isHidden()
4359+
private predicate localStepToHidden(PathNodeImpl n1, PathNodeImpl n2) {
4360+
n2 = localStep(n1) and
4361+
n2.isHidden()
43624362
}
43634363

4364-
private PathNodeImpl localStepFromHidden(PathNodeImpl n) {
4365-
n = localStep(result) and
4366-
result.isHidden()
4364+
private predicate localStepFromHidden(PathNodeImpl n1, PathNodeImpl n2) {
4365+
n2 = localStep(n1) and
4366+
n1.isHidden()
43674367
}
43684368

43694369
pragma[nomagic]
@@ -4404,15 +4404,17 @@ module MakeImpl<InputSig Lang> {
44044404
PathNodeImpl arg, PathNodeImpl par, PathNodeImpl ret, PathNodeImpl out
44054405
) {
44064406
// direct subpath
4407-
subpaths04(arg, localStepFromHidden*(par), localStepToHidden*(ret), out) and
4407+
subpaths04(arg, any(PathNodeImpl n | localStepFromHidden*(n, par)),
4408+
any(PathNodeImpl n | localStepToHidden*(ret, n)), out) and
44084409
not par.isHidden() and
44094410
not ret.isHidden() and
44104411
ret = summaryCtxStep*(par)
44114412
or
44124413
// wrapped subpath using hidden nodes, e.g. flow through a callback inside
44134414
// a summarized callable
44144415
exists(PathNodeImpl par0, PathNodeImpl ret0 |
4415-
subpaths05(localStepToHidden*(par0), par, ret, localStepFromHidden*(ret0)) and
4416+
subpaths05(any(PathNodeImpl n | localStepToHidden*(par0, n)), par, ret,
4417+
any(PathNodeImpl n | localStepFromHidden*(n, ret0))) and
44164418
subpaths04(arg, par0, ret0, out)
44174419
)
44184420
}
@@ -4426,7 +4428,8 @@ module MakeImpl<InputSig Lang> {
44264428
*/
44274429
pragma[nomagic]
44284430
predicate subpaths(PathNodeImpl arg, PathNodeImpl par, PathNodeImpl ret, PathNodeImpl out) {
4429-
subpaths05(localStepToHidden*(arg), par, ret, localStepFromHidden*(out)) and
4431+
subpaths05(any(PathNodeImpl n | localStepToHidden*(arg, n)), par, ret,
4432+
any(PathNodeImpl n | localStepFromHidden*(n, out))) and
44304433
not arg.isHidden() and
44314434
not out.isHidden()
44324435
}

0 commit comments

Comments
 (0)