Skip to content

Commit 58dd758

Browse files
committed
C#: Update flow summary to avoid negative recursion
1 parent ac41451 commit 58dd758

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

csharp/ql/lib/semmle/code/csharp/frameworks/EntityFramework.qll

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -174,32 +174,34 @@ module EntityFramework {
174174
}
175175
}
176176

177-
private class RawSqlStringSummarizedCallable extends EFSummarizedCallable {
178-
private SummaryComponentStack input_;
179-
private SummaryComponentStack output_;
180-
private boolean preservesValue_;
181-
182-
RawSqlStringSummarizedCallable() {
177+
private class RawSqlStringConstructorSummarizedCallable extends EFSummarizedCallable {
178+
RawSqlStringConstructorSummarizedCallable() {
183179
exists(RawSqlStringStruct s |
184180
this = s.getAConstructor() and
185-
input_ = SummaryComponentStack::argument(0) and
186-
this.getNumberOfParameters() > 0 and
187-
output_ = SummaryComponentStack::return() and
188-
preservesValue_ = false
189-
or
190-
this = s.getAConversionTo() and
191-
input_ = SummaryComponentStack::argument(0) and
192-
output_ = SummaryComponentStack::return() and
193-
preservesValue_ = false
181+
this.getNumberOfParameters() > 0
194182
)
195183
}
196184

197185
override predicate propagatesFlow(
198186
SummaryComponentStack input, SummaryComponentStack output, boolean preservesValue
199187
) {
200-
input = input_ and
201-
output = output_ and
202-
preservesValue = preservesValue_
188+
input = SummaryComponentStack::argument(0) and
189+
output = SummaryComponentStack::return() and
190+
preservesValue = false
191+
}
192+
}
193+
194+
private class RawSqlStringConversionSummarizedCallable extends EFSummarizedCallable {
195+
RawSqlStringConversionSummarizedCallable() {
196+
exists(RawSqlStringStruct s | this = s.getAConversionTo())
197+
}
198+
199+
override predicate propagatesFlow(
200+
SummaryComponentStack input, SummaryComponentStack output, boolean preservesValue
201+
) {
202+
input = SummaryComponentStack::argument(0) and
203+
output = SummaryComponentStack::return() and
204+
preservesValue = false
203205
}
204206
}
205207

0 commit comments

Comments
 (0)