Skip to content

Commit 0d45074

Browse files
authored
Merge pull request github#13422 from asgerf/rb/map_filter
Ruby: fix bug in filter_map summary
2 parents aed6a75 + 452af31 commit 0d45074

File tree

5 files changed

+6224
-6184
lines changed

5 files changed

+6224
-6184
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2067,7 +2067,11 @@ module Enumerable {
20672067

20682068
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
20692069
input = "Argument[self].Element[any]" and
2070-
output = ["Argument[block].Parameter[0]", "ReturnValue.Element[?]"] and
2070+
output = "Argument[block].Parameter[0]" and
2071+
preservesValue = true
2072+
or
2073+
input = "Argument[block].ReturnValue" and
2074+
output = "ReturnValue.Element[?]" and
20712075
preservesValue = true
20722076
}
20732077
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* Fixed a bug in how `map_filter` calls are analyzed. Previously, such calls would
5+
appear to the return the receiver of the call, but now the return value of the callback
6+
is properly taken into account.

0 commit comments

Comments
 (0)