Skip to content

Commit 349268c

Browse files
committed
Expand the range of callables used in source to include potential virtual dispatch targets and referenced callables (e.g., in assigning a delegate)
1 parent 66f48f7 commit 349268c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,15 @@ private class CallableUsedInSource extends Callable {
10031003
CallableUsedInSource() {
10041004
this.fromSource()
10051005
or
1006-
this.getACall().fromSource()
1006+
// Note that getARuntimeTarget cannot be used here, because the
1007+
// DelegateLikeCall case depends on lambda-flow, which in turn
1008+
// uses the dataflow library; hence this would introduce recursion
1009+
// into the definition of data-flow nodes.
1010+
exists(Call c, DispatchCall dc | c.fromSource() and c = dc.getCall() |
1011+
this = dc.getADynamicTarget()
1012+
)
1013+
or
1014+
this = any(CallableAccess ca | ca.fromSource()).getTarget()
10071015
}
10081016
}
10091017

0 commit comments

Comments
 (0)