Skip to content

Commit 379de55

Browse files
committed
Ruby: Disable summaries that clash with Array
Some String methods are named identically to Array methods, and this leads to overlapping flow summaries. These adversely affect the original Array flow summaries.
1 parent fef46e1 commit 379de55

File tree

3 files changed

+658
-730
lines changed

3 files changed

+658
-730
lines changed

ruby/ql/lib/codeql/ruby/frameworks/core/String.qll

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,12 @@ module String {
175175
* A flow summary for `String#concat` and `String#prepend`.
176176
*/
177177
private class ConcatSummary extends SimpleSummarizedCallable {
178-
ConcatSummary() { this = ["concat", "prepend"] }
178+
ConcatSummary() {
179+
// `concat` and `prepend` omitted because they clash with the summaries for
180+
// `Array#concat` and `Array#prepend`.
181+
// this = ["concat", "prepend"]
182+
none()
183+
}
179184

180185
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
181186
input = ["Receiver", "Argument[_]"] and
@@ -304,7 +309,11 @@ module String {
304309
* A flow summary for `String#insert`.
305310
*/
306311
private class InsertSummary extends SimpleSummarizedCallable {
307-
InsertSummary() { this = "insert" }
312+
InsertSummary() {
313+
this = "insert" and
314+
// Disabled because it clashes with the summary for Array#insert.
315+
none()
316+
}
308317

309318
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
310319
(

0 commit comments

Comments
 (0)