Skip to content

Commit ddde1d4

Browse files
committed
C#: Remove default clears content.
1 parent 5119de8 commit ddde1d4

File tree

4 files changed

+6
-25
lines changed

4 files changed

+6
-25
lines changed

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -139,28 +139,6 @@ private class RecordConstructorFlow extends SummarizedCallable {
139139
}
140140
}
141141

142-
private class SummarizedCallableDefaultClearsContent extends Impl::Public::SummarizedCallable {
143-
SummarizedCallableDefaultClearsContent() {
144-
this instanceof Impl::Public::SummarizedCallable or none()
145-
}
146-
147-
// By default, we assume that all stores into arguments are definite
148-
override predicate clearsContent(ParameterPosition pos, DataFlow::ContentSet content) {
149-
exists(SummaryComponentStack output, SummaryComponent target |
150-
this.propagatesFlow(_, output, _) and
151-
output.drop(_) =
152-
SummaryComponentStack::push(SummaryComponent::content(content),
153-
SummaryComponentStack::singleton(target)) and
154-
not content instanceof DataFlow::ElementContent
155-
|
156-
target = SummaryComponent::argument(pos.getPosition())
157-
or
158-
target = SummaryComponent::qualifier() and
159-
pos.isThisParameter()
160-
)
161-
}
162-
}
163-
164142
class RequiredSummaryComponentStack = Impl::Public::RequiredSummaryComponentStack;
165143

166144
private class RecordConstructorFlowRequiredSummaryComponentStack extends RequiredSummaryComponentStack {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,8 @@ module Private {
933933
summaryElement(this, inSpec, outSpec, kind, false)
934934
or
935935
summaryElement(this, inSpec, outSpec, kind, true) and
936-
not summaryElement(this, _, _, _, false)
936+
not summaryElement(this, _, _, _, false) and
937+
not this.clearsContent(_, _)
937938
}
938939

939940
override predicate propagatesFlow(

java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,8 @@ module Private {
933933
summaryElement(this, inSpec, outSpec, kind, false)
934934
or
935935
summaryElement(this, inSpec, outSpec, kind, true) and
936-
not summaryElement(this, _, _, _, false)
936+
not summaryElement(this, _, _, _, false) and
937+
not this.clearsContent(_, _)
937938
}
938939

939940
override predicate propagatesFlow(

ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,8 @@ module Private {
933933
summaryElement(this, inSpec, outSpec, kind, false)
934934
or
935935
summaryElement(this, inSpec, outSpec, kind, true) and
936-
not summaryElement(this, _, _, _, false)
936+
not summaryElement(this, _, _, _, false) and
937+
not this.clearsContent(_, _)
937938
}
938939

939940
override predicate propagatesFlow(

0 commit comments

Comments
 (0)