C#: Make it possible to describe flow for properties using their backing methods.

This commit is contained in:
Michael Nebel
2021-12-02 15:02:22 +01:00
parent 37644d30d2
commit f190d60912

View File

@@ -78,6 +78,7 @@ private import internal.DataFlowPublic
private import internal.FlowSummaryImpl::Public
private import internal.FlowSummaryImpl::Private::External
private import internal.FlowSummaryImplSpecific
private import semmle.code.csharp.dispatch.OverridableCallable
/**
* A module importing the frameworks that provide external flow data,
@@ -347,12 +348,15 @@ private class UnboundValueOrRefType extends ValueOrRefType {
}
}
private class UnboundCallable extends Callable, Virtualizable {
private class UnboundCallable extends Callable {
UnboundCallable() { this.isUnboundDeclaration() }
predicate overridesOrImplementsUnbound(UnboundCallable that) {
exists(Callable c |
this.overridesOrImplementsOrEquals(c) and
this.(Virtualizable).overridesOrImplementsOrEquals(c) or
this = c.(OverridableCallable).getAnUltimateImplementor() or
this = c.(OverridableCallable).getAnOverrider+()
|
this != c and
that = c.getUnboundDeclaration()
)
@@ -409,7 +413,7 @@ private Element interpretElement0(
string namespace, string type, boolean subtypes, string name, string signature
) {
exists(UnboundValueOrRefType t | elementSpec(namespace, type, subtypes, name, signature, _, t) |
exists(Member m |
exists(Declaration m |
(
result = m
or