Skip to content

Commit 342c876

Browse files
authored
Merge pull request #10433 from michaelnebel/csharp/fix-joinorder-interpretedcallable
C#: Fix join order in InterpretedCallable characteristic predicate.
2 parents 4963835 + faf33ef commit 342c876

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

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

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -504,16 +504,36 @@ class UnboundCallable extends Callable {
504504
}
505505
}
506506

507+
pragma[nomagic]
508+
private predicate callableSpecInfo(Callable c, string namespace, string type, string name) {
509+
c.getDeclaringType().hasQualifiedName(namespace, type) and
510+
c.getName() = name
511+
}
512+
513+
pragma[nomagic]
514+
private predicate subtypeSpecCandidate(string name, UnboundValueOrRefType t) {
515+
exists(UnboundValueOrRefType t0 |
516+
elementSpec(_, _, true, name, _, _, t0) and
517+
t = t0.getASubTypeUnbound+()
518+
)
519+
}
520+
521+
pragma[nomagic]
522+
private predicate callableInfo(Callable c, string name, UnboundValueOrRefType decl) {
523+
name = c.getName() and
524+
decl = c.getDeclaringType()
525+
}
526+
507527
private class InterpretedCallable extends Callable {
508528
InterpretedCallable() {
509-
exists(UnboundValueOrRefType t, boolean subtypes, string name |
510-
elementSpec(_, _, subtypes, name, _, _, t) and
511-
this.hasName(name)
512-
|
513-
this.getDeclaringType() = t
514-
or
515-
subtypes = true and
516-
this.getDeclaringType() = t.getASubTypeUnbound+()
529+
exists(string namespace, string type, string name |
530+
callableSpecInfo(this, namespace, type, name) and
531+
elementSpec(namespace, type, _, name, _, _)
532+
)
533+
or
534+
exists(string name, UnboundValueOrRefType t |
535+
callableInfo(this, name, t) and
536+
subtypeSpecCandidate(name, t)
517537
)
518538
}
519539
}

0 commit comments

Comments
 (0)