Skip to content

Commit 26e2cad

Browse files
michaelnebelhvitved
authored andcommitted
C#: Improve getCallable.
1 parent f78def5 commit 26e2cad

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowDispatch.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,11 @@ class NonDelegateDataFlowCall extends DataFlowCall, TNonDelegateCall {
318318
override DataFlowCallable getARuntimeTarget() {
319319
result.asCallable() = getCallableForDataFlow(dc.getADynamicTarget())
320320
or
321-
result.asSummarizedCallable() = dc.getAStaticTarget().getUnboundDeclaration()
321+
exists(Callable c | result.asSummarizedCallable() = c.getUnboundDeclaration() |
322+
c = dc.getADynamicTarget()
323+
or
324+
c = dc.getAStaticTarget() and not c instanceof RuntimeCallable
325+
)
322326
}
323327

324328
override ControlFlow::Nodes::ElementNode getControlFlowNode() { result = cfn }

0 commit comments

Comments
 (0)