mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Dataflow: Simplify the call-edge join in reverse through-flow.
This commit is contained in:
@@ -2187,11 +2187,11 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate flowThroughIntoCall(
|
private predicate flowThroughIntoCall(
|
||||||
DataFlowCall call, ArgNodeEx arg, ParamNodeEx p, Ap argAp, Ap ap
|
DataFlowCall call, ArgNodeEx arg, ParamNodeEx p, Ap argAp
|
||||||
) {
|
) {
|
||||||
exists(Typ argT, TypOption argStored |
|
exists(Typ argT, TypOption argStored |
|
||||||
returnFlowsThrough(_, _, _, _, pragma[only_bind_into](p), pragma[only_bind_into](argT),
|
returnFlowsThrough(_, _, _, _, pragma[only_bind_into](p), pragma[only_bind_into](argT),
|
||||||
pragma[only_bind_into](argAp), pragma[only_bind_into](argStored), ap) and
|
pragma[only_bind_into](argAp), pragma[only_bind_into](argStored), _) and
|
||||||
flowIntoCallTaken(call, _, pragma[only_bind_into](arg), p, isNil(argAp)) and
|
flowIntoCallTaken(call, _, pragma[only_bind_into](arg), p, isNil(argAp)) and
|
||||||
fwdFlow(arg, _, _, _, pragma[only_bind_into](argT), pragma[only_bind_into](argAp),
|
fwdFlow(arg, _, _, _, pragma[only_bind_into](argT), pragma[only_bind_into](argAp),
|
||||||
pragma[only_bind_into](argStored))
|
pragma[only_bind_into](argStored))
|
||||||
@@ -2285,9 +2285,9 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
|
|||||||
returnAp = apNone()
|
returnAp = apNone()
|
||||||
or
|
or
|
||||||
// flow through a callable
|
// flow through a callable
|
||||||
exists(DataFlowCall call, ParamNodeEx p, Ap innerReturnAp |
|
exists(DataFlowCall call, ParamNodeEx p |
|
||||||
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp) and
|
revFlowThrough(call, returnCtx, p, state, returnAp, ap) and
|
||||||
flowThroughIntoCall(call, node, p, ap, innerReturnAp)
|
flowThroughIntoCall(call, node, p, ap)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
// flow out of a callable
|
// flow out of a callable
|
||||||
@@ -2437,11 +2437,13 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate revFlowThrough(
|
private predicate revFlowThrough(
|
||||||
DataFlowCall call, ReturnCtx returnCtx, ParamNodeEx p, FlowState state,
|
DataFlowCall call, ReturnCtx returnCtx, ParamNodeEx p, FlowState state, ApOption returnAp,
|
||||||
ReturnPosition pos, ApOption returnAp, Ap ap, Ap innerReturnAp
|
Ap ap
|
||||||
) {
|
) {
|
||||||
revFlowParamToReturn(p, state, pos, innerReturnAp, ap) and
|
exists(ReturnPosition pos, Ap innerReturnAp |
|
||||||
revFlowIsReturned(call, returnCtx, returnAp, pos, innerReturnAp)
|
revFlowParamToReturn(p, state, pos, innerReturnAp, ap) and
|
||||||
|
revFlowIsReturned(call, returnCtx, returnAp, pos, innerReturnAp)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2567,9 +2569,9 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
|
|||||||
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
||||||
Ap ap
|
Ap ap
|
||||||
) {
|
) {
|
||||||
exists(ParamNodeEx p, Ap innerReturnAp |
|
exists(ParamNodeEx p |
|
||||||
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp) and
|
revFlowThrough(call, returnCtx, p, state, returnAp, ap) and
|
||||||
flowThroughIntoCall(call, arg, p, ap, innerReturnAp)
|
flowThroughIntoCall(call, arg, p, ap)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user