Skip to content

Commit 3e3ea51

Browse files
committed
C#: Correctly parse operator names in MaD
1 parent 2a33a86 commit 3e3ea51

File tree

3 files changed

+671
-3
lines changed

3 files changed

+671
-3
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,17 @@ class UnboundCallable extends Callable {
328328
}
329329
}
330330

331+
private predicate hasName(Declaration d, string name) {
332+
d.(Operator).getFunctionName() = name
333+
or
334+
not d instanceof Operator and
335+
d.hasName(name)
336+
}
337+
331338
pragma[nomagic]
332339
private predicate callableSpecInfo(Callable c, string namespace, string type, string name) {
333340
c.getDeclaringType().hasQualifiedName(namespace, type) and
334-
c.getName() = name
341+
hasName(c, name)
335342
}
336343

337344
pragma[nomagic]
@@ -344,7 +351,7 @@ private predicate subtypeSpecCandidate(string name, UnboundValueOrRefType t) {
344351

345352
pragma[nomagic]
346353
private predicate callableInfo(Callable c, string name, UnboundValueOrRefType decl) {
347-
name = c.getName() and
354+
hasName(c, name) and
348355
decl = c.getDeclaringType()
349356
}
350357

@@ -405,7 +412,7 @@ private Element interpretElement0(
405412
subtypes = true and result.(UnboundCallable).overridesOrImplementsUnbound(m)
406413
) and
407414
m.getDeclaringType() = t and
408-
m.hasName(name)
415+
hasName(m, name)
409416
|
410417
signature = ""
411418
or

0 commit comments

Comments
 (0)