Skip to content

Commit e53b4c1

Browse files
committed
C#: Revert change to getASummarizedCallableTarget
1 parent 4a90f84 commit e53b4c1

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,21 @@ class NonDelegateDataFlowCall extends DataFlowCall, TNonDelegateCall {
371371
/** Gets the underlying call. */
372372
DispatchCall getDispatchCall() { result = dc }
373373

374+
pragma[nomagic]
375+
private predicate hasSourceTarget() { dc.getAStaticTarget().fromSource() }
376+
374377
pragma[nomagic]
375378
private FlowSummary::SummarizedCallable getASummarizedCallableTarget() {
376-
result = this.getATarget(_)
379+
// Only use summarized callables with generated summaries in case
380+
// we are not able to dispatch to a source declaration.
381+
exists(boolean static |
382+
result = this.getATarget(static) and
383+
if this.hasSourceTarget() then result.hasManualModel() else any()
384+
|
385+
static = false
386+
or
387+
static = true and not result instanceof RuntimeCallable
388+
)
377389
}
378390

379391
pragma[nomagic]

0 commit comments

Comments
 (0)