mirror of
https://github.com/github/codeql.git
synced 2026-05-01 19:55:15 +02:00
C#: Fix issue with summary tests, such that the output is compatiable with flow summary interpreter.
This commit is contained in:
@@ -357,9 +357,14 @@ private class UnboundValueOrRefType extends ValueOrRefType {
|
||||
}
|
||||
}
|
||||
|
||||
private class UnboundCallable extends Callable {
|
||||
/** An unbound callable. */
|
||||
class UnboundCallable extends Callable {
|
||||
UnboundCallable() { this.isUnboundDeclaration() }
|
||||
|
||||
/**
|
||||
* Holds if this unbound callable overrides or implements (transitively)
|
||||
* `that` unbound callable.
|
||||
*/
|
||||
predicate overridesOrImplementsUnbound(UnboundCallable that) {
|
||||
exists(Callable c |
|
||||
this.(Virtualizable).overridesOrImplementsOrEquals(c) or
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import shared.FlowSummaries
|
||||
private import semmle.code.csharp.dataflow.ExternalFlow
|
||||
|
||||
class IncludeFilteredSummarizedCallable extends IncludeSummarizedCallable {
|
||||
IncludeFilteredSummarizedCallable() { this instanceof SummarizedCallable }
|
||||
@@ -14,8 +15,8 @@ class IncludeFilteredSummarizedCallable extends IncludeSummarizedCallable {
|
||||
this.propagatesFlow(input, output, preservesValue) and
|
||||
not exists(IncludeSummarizedCallable rsc |
|
||||
rsc.isBaseCallableOrPrototype() and
|
||||
this.(Virtualizable).overridesOrImplements(rsc) and
|
||||
rsc.propagatesFlow(input, output, preservesValue)
|
||||
rsc.propagatesFlow(input, output, preservesValue) and
|
||||
this.(UnboundCallable).overridesOrImplementsUnbound(rsc)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,11 @@ abstract class IncludeSummarizedCallable extends RelevantSummarizedCallable {
|
||||
predicate isBaseCallableOrPrototype() {
|
||||
this.getDeclaringType() instanceof Interface
|
||||
or
|
||||
this.(Modifiable).isAbstract()
|
||||
or
|
||||
this.getDeclaringType().(Modifiable).isAbstract() and this.(Virtualizable).isVirtual()
|
||||
exists(Modifiable m | m = [this.(Modifiable), this.(Accessor).getDeclaration()] |
|
||||
m.isAbstract()
|
||||
or
|
||||
this.getDeclaringType().(Modifiable).isAbstract() and m.(Virtualizable).isVirtual()
|
||||
)
|
||||
}
|
||||
|
||||
/** Gets a string representing, whether the summary should apply for all overrides of this. */
|
||||
|
||||
Reference in New Issue
Block a user