mirror of
https://github.com/github/codeql.git
synced 2025-12-24 12:46:34 +01:00
Ruby: Avoid SummarizedCallable::propagatesFlowExt being recursive
This commit is contained in:
@@ -140,10 +140,9 @@ module Array {
|
||||
}
|
||||
}
|
||||
|
||||
private class SetDifferenceSummary extends SummarizedCallable {
|
||||
SetDifferenceSummary() { this = "-" }
|
||||
|
||||
override SubExpr getACallSimple() { any() }
|
||||
abstract private class DifferenceSummaryShared extends SummarizedCallable {
|
||||
bindingset[this]
|
||||
DifferenceSummaryShared() { any() }
|
||||
|
||||
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
|
||||
input = "Argument[self].Element[any]" and
|
||||
@@ -152,6 +151,12 @@ module Array {
|
||||
}
|
||||
}
|
||||
|
||||
private class SetDifferenceSummary extends DifferenceSummaryShared {
|
||||
SetDifferenceSummary() { this = "-" }
|
||||
|
||||
override SubExpr getACallSimple() { any() }
|
||||
}
|
||||
|
||||
/** Flow summary for `Array#<<`. For `Array#append`, see `PushSummary`. */
|
||||
private class AppendOperatorSummary extends SummarizedCallable {
|
||||
AppendOperatorSummary() { this = "<<" }
|
||||
@@ -687,14 +692,8 @@ module Array {
|
||||
}
|
||||
}
|
||||
|
||||
private class DifferenceSummary extends SimpleSummarizedCallable {
|
||||
private class DifferenceSummary extends DifferenceSummaryShared, SimpleSummarizedCallable {
|
||||
DifferenceSummary() { this = "difference" }
|
||||
|
||||
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
|
||||
// `Array#difference` and `Array#-` do not behave exactly the same way,
|
||||
// but we model their flow the same way.
|
||||
any(SetDifferenceSummary s).propagatesFlowExt(input, output, preservesValue)
|
||||
}
|
||||
}
|
||||
|
||||
private string getDigArg(MethodCall dig, int i) {
|
||||
|
||||
Reference in New Issue
Block a user