C#: Fix broken viableImplInCallContext implementation

This commit is contained in:
Tom Hvitved
2022-09-21 14:49:08 +02:00
parent f4b82cb2e8
commit 914c711940

View File

@@ -175,10 +175,19 @@ private module DispatchImpl {
* restricted to those `call`s for which a context might make a difference.
*/
DataFlowCallable viableImplInCallContext(NonDelegateDataFlowCall call, DataFlowCall ctx) {
result.getUnderlyingCallable() =
call.getDispatchCall()
.getADynamicTargetInCallContext(ctx.(NonDelegateDataFlowCall).getDispatchCall())
.getUnboundDeclaration()
exists(DispatchCall dc | dc = call.getDispatchCall() |
result.getUnderlyingCallable() =
getCallableForDataFlow(dc.getADynamicTargetInCallContext(ctx.(NonDelegateDataFlowCall)
.getDispatchCall()).getUnboundDeclaration())
or
exists(Callable c, DataFlowCallable encl |
result.asSummarizedCallable() = c and
mayBenefitFromCallContext(call, encl) and
encl = ctx.getARuntimeTarget() and
c = dc.getAStaticTarget().getUnboundDeclaration() and
not c instanceof RuntimeCallable
)
)
}
}