Skip to content

Commit fc1bc3a

Browse files
committed
Address review comments
1 parent 5f9b8c0 commit fc1bc3a

File tree

1 file changed

+21
-24
lines changed

1 file changed

+21
-24
lines changed

shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,27 +1435,19 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
14351435
string model, CachedCallContextSensitivity::CcNoCall ctx
14361436
) {
14371437
exists(
1438-
DataFlowCall call, DataFlowCallable callable, ArgNode arg, string model1, string model2,
1439-
CachedCallContextSensitivity::CcNoCall ctx1, CachedCallContextSensitivity::CcNoCall ctx2
1438+
ArgNode arg, string model1, string model2, CachedCallContextSensitivity::CcNoCall ctx1,
1439+
CachedCallContextSensitivity::CcNoCall ctx2
14401440
|
14411441
model = mergeModels(model1, model2) and
1442-
(
1443-
// call may restrict the set of call sites that can be returned to
1444-
ctx2.(CachedCallContextSensitivity::CcReturn).isReturn(callable, call)
1445-
or
1446-
// call does not restrict the set of call sites that can be returned to
1447-
not exists(CachedCallContextSensitivity::CcReturn ret | ret.isReturn(callable, call)) and
1448-
CachedCallContextSensitivity::viableImplNotCallContextReducedReverse(ctx2)
1449-
) and
14501442
ctx = mergeContexts(ctx1, ctx2)
14511443
|
14521444
// flow through: no prior read
14531445
parameterValueFlowArg(p, arg, mustBeNone, model1, ctx1) and
1454-
argumentValueFlowsThrough(call, callable, arg, read, node, model2)
1446+
argumentValueFlowsThrough(arg, read, node, model2, ctx2)
14551447
or
14561448
// flow through: no read inside method
14571449
parameterValueFlowArg(p, arg, read, model1, ctx1) and
1458-
argumentValueFlowsThrough(call, callable, arg, mustBeNone, node, model2)
1450+
argumentValueFlowsThrough(arg, mustBeNone, node, model2, ctx2)
14591451
)
14601452
}
14611453

@@ -1470,27 +1462,32 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
14701462

14711463
pragma[nomagic]
14721464
private predicate argumentValueFlowsThrough0(
1473-
DataFlowCall call, DataFlowCallable callable, ArgNode arg, ReturnKind kind,
1474-
ReadStepTypesOption read, string model
1465+
DataFlowCall call, ArgNode arg, ReturnKind kind, ReadStepTypesOption read, string model,
1466+
CachedCallContextSensitivity::CcNoCall outerCtx
14751467
) {
1476-
exists(ParamNode param, CachedCallContextSensitivity::CcNoCall ctx |
1468+
exists(
1469+
ParamNode param, DataFlowCallable callable,
1470+
CachedCallContextSensitivity::CcNoCall innerCtx
1471+
|
14771472
viableParamArg(call, param, arg) and
1478-
parameterValueFlowReturn(param, kind, read, model, ctx) and
1479-
callable = nodeGetEnclosingCallable(param)
1473+
parameterValueFlowReturn(param, kind, read, model, innerCtx) and
1474+
callable = nodeGetEnclosingCallable(param) and
1475+
outerCtx = CachedCallContextSensitivity::getCallContextReturn(callable, call)
14801476
|
1481-
CachedCallContextSensitivity::viableImplNotCallContextReducedReverse(ctx)
1477+
CachedCallContextSensitivity::viableImplNotCallContextReducedReverse(innerCtx)
14821478
or
1483-
call = CachedCallContextSensitivity::viableImplCallContextReducedReverse(callable, ctx)
1479+
call =
1480+
CachedCallContextSensitivity::viableImplCallContextReducedReverse(callable, innerCtx)
14841481
)
14851482
}
14861483

14871484
pragma[nomagic]
14881485
private predicate argumentValueFlowsThrough(
1489-
DataFlowCall call, DataFlowCallable callable, ArgNode arg, ReadStepTypesOption read,
1490-
Node out, string model
1486+
ArgNode arg, ReadStepTypesOption read, Node out, string model,
1487+
CachedCallContextSensitivity::CcNoCall ctx
14911488
) {
1492-
exists(ReturnKind kind |
1493-
argumentValueFlowsThrough0(call, callable, arg, kind, read, model) and
1489+
exists(DataFlowCall call, ReturnKind kind |
1490+
argumentValueFlowsThrough0(call, arg, kind, read, model, ctx) and
14941491
out = getAnOutNode(call, kind)
14951492
|
14961493
// normal flow through
@@ -1515,7 +1512,7 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
15151512
predicate argumentValueFlowsThrough(
15161513
ArgNode arg, ReadStepTypesOption read, Node out, string model
15171514
) {
1518-
argumentValueFlowsThrough(_, _, arg, read, out, model)
1515+
argumentValueFlowsThrough(arg, read, out, model, _)
15191516
}
15201517

15211518
/**

0 commit comments

Comments
 (0)