Skip to content

Commit a964f53

Browse files
committed
C#: Fix issue with dispatch to implementations of virtual interface members.
1 parent 278f90e commit a964f53

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

csharp/ql/lib/semmle/code/csharp/dispatch/Dispatch.qll

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,10 @@ private module Internal {
497497
result = c.getAnOverrider(t)
498498
)
499499
or
500-
exists(NonConstructedOverridableCallable c |
500+
exists(NonConstructedOverridableCallable c, NonConstructedOverridableCallable mid |
501501
c = this.getAViableOverrider0() and
502-
result = c.getAnOverrider(_)
502+
c = mid.getUnboundDeclaration() and
503+
result = mid.getAnOverrider(_)
503504
|
504505
this.hasUnconstrainedTypeParameterQualifierType()
505506
or
@@ -1115,8 +1116,7 @@ private module Internal {
11151116

11161117
/** A call using reflection. */
11171118
private class DispatchReflectionCall extends DispatchReflectionOrDynamicCall,
1118-
TDispatchReflectionCall
1119-
{
1119+
TDispatchReflectionCall {
11201120
override MethodCall getCall() { this = TDispatchReflectionCall(result, _, _, _, _) }
11211121

11221122
override string getName() { this = TDispatchReflectionCall(_, result, _, _, _) }
@@ -1164,8 +1164,7 @@ private module Internal {
11641164

11651165
/** A method call using dynamic types. */
11661166
private class DispatchDynamicMethodCall extends DispatchReflectionOrDynamicCall,
1167-
TDispatchDynamicMethodCall
1168-
{
1167+
TDispatchDynamicMethodCall {
11691168
override DynamicMethodCall getCall() { this = TDispatchDynamicMethodCall(result) }
11701169

11711170
override string getName() { result = this.getCall().getLateBoundTargetName() }
@@ -1186,8 +1185,7 @@ private module Internal {
11861185

11871186
/** An operator call using dynamic types. */
11881187
private class DispatchDynamicOperatorCall extends DispatchReflectionOrDynamicCall,
1189-
TDispatchDynamicOperatorCall
1190-
{
1188+
TDispatchDynamicOperatorCall {
11911189
override DynamicOperatorCall getCall() { this = TDispatchDynamicOperatorCall(result) }
11921190

11931191
override string getName() {
@@ -1204,8 +1202,7 @@ private module Internal {
12041202

12051203
/** A (potential) call to a property accessor using dynamic types. */
12061204
private class DispatchDynamicMemberAccess extends DispatchReflectionOrDynamicCall,
1207-
TDispatchDynamicMemberAccess
1208-
{
1205+
TDispatchDynamicMemberAccess {
12091206
override DynamicMemberAccess getCall() { this = TDispatchDynamicMemberAccess(result) }
12101207

12111208
override string getName() {
@@ -1229,8 +1226,7 @@ private module Internal {
12291226

12301227
/** A (potential) call to an indexer accessor using dynamic types. */
12311228
private class DispatchDynamicElementAccess extends DispatchReflectionOrDynamicCall,
1232-
TDispatchDynamicElementAccess
1233-
{
1229+
TDispatchDynamicElementAccess {
12341230
override DynamicElementAccess getCall() { this = TDispatchDynamicElementAccess(result) }
12351231

12361232
override string getName() {
@@ -1256,8 +1252,7 @@ private module Internal {
12561252

12571253
/** A (potential) call to an event accessor using dynamic types. */
12581254
private class DispatchDynamicEventAccess extends DispatchReflectionOrDynamicCall,
1259-
TDispatchDynamicEventAccess
1260-
{
1255+
TDispatchDynamicEventAccess {
12611256
override AssignArithmeticOperation getCall() {
12621257
this = TDispatchDynamicEventAccess(result, _, _)
12631258
}
@@ -1274,8 +1269,7 @@ private module Internal {
12741269

12751270
/** A call to a constructor using dynamic types. */
12761271
private class DispatchDynamicObjectCreation extends DispatchReflectionOrDynamicCall,
1277-
TDispatchDynamicObjectCreation
1278-
{
1272+
TDispatchDynamicObjectCreation {
12791273
override DynamicObjectCreation getCall() { this = TDispatchDynamicObjectCreation(result) }
12801274

12811275
override string getName() { none() }

0 commit comments

Comments
 (0)