Skip to content

Commit ae65af2

Browse files
committed
Ruby: Fix Argument[any] in Hash.qll
With this PR, `self` have to be explicitly added. A few edges were removed, and I don't know why. It doesn't seem to affect results, so I did not worry too much.
1 parent 04ac466 commit ae65af2

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,10 @@ private class MergeSummary extends SimpleSummarizedCallable {
362362

363363
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
364364
(
365-
input = "Argument[any].WithElement[any]" and
365+
input = "Argument[self,any].WithElement[any]" and
366366
output = "ReturnValue"
367367
or
368-
input = "Argument[any].Element[any]" and
368+
input = "Argument[self,any].Element[any]" and
369369
output = "Argument[block].Parameter[1,2]"
370370
) and
371371
preservesValue = true
@@ -377,10 +377,10 @@ private class MergeBangSummary extends SimpleSummarizedCallable {
377377

378378
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
379379
(
380-
input = "Argument[any].WithElement[any]" and
380+
input = "Argument[self,any].WithElement[any]" and
381381
output = ["ReturnValue", "Argument[self]"]
382382
or
383-
input = "Argument[any].Element[any]" and
383+
input = "Argument[self,any].Element[any]" and
384384
output = "Argument[block].Parameter[1,2]"
385385
) and
386386
preservesValue = true

ruby/ql/test/library-tests/dataflow/hash-flow/hash-flow.expected

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,7 @@ edges
248248
| hash_flow.rb:414:11:414:14 | hash [element :f] : | hash_flow.rb:414:11:414:18 | ...[...] : |
249249
| hash_flow.rb:414:11:414:18 | ...[...] : | hash_flow.rb:414:10:414:19 | ( ... ) |
250250
| hash_flow.rb:421:15:421:25 | call to taint : | hash_flow.rb:430:12:430:16 | hash1 [element :a] : |
251-
| hash_flow.rb:421:15:421:25 | call to taint : | hash_flow.rb:442:11:442:15 | hash1 [element :a] : |
252251
| hash_flow.rb:423:15:423:25 | call to taint : | hash_flow.rb:430:12:430:16 | hash1 [element :c] : |
253-
| hash_flow.rb:423:15:423:25 | call to taint : | hash_flow.rb:444:11:444:15 | hash1 [element :c] : |
254252
| hash_flow.rb:426:15:426:25 | call to taint : | hash_flow.rb:430:25:430:29 | hash2 [element :d] : |
255253
| hash_flow.rb:428:15:428:25 | call to taint : | hash_flow.rb:430:25:430:29 | hash2 [element :f] : |
256254
| hash_flow.rb:430:12:430:16 | [post] hash1 [element :a] : | hash_flow.rb:442:11:442:15 | hash1 [element :a] : |
@@ -444,9 +442,7 @@ edges
444442
| hash_flow.rb:663:11:663:14 | hash [element] : | hash_flow.rb:663:11:663:18 | ...[...] : |
445443
| hash_flow.rb:663:11:663:18 | ...[...] : | hash_flow.rb:663:10:663:19 | ( ... ) |
446444
| hash_flow.rb:670:15:670:25 | call to taint : | hash_flow.rb:679:12:679:16 | hash1 [element :a] : |
447-
| hash_flow.rb:670:15:670:25 | call to taint : | hash_flow.rb:691:11:691:15 | hash1 [element :a] : |
448445
| hash_flow.rb:672:15:672:25 | call to taint : | hash_flow.rb:679:12:679:16 | hash1 [element :c] : |
449-
| hash_flow.rb:672:15:672:25 | call to taint : | hash_flow.rb:693:11:693:15 | hash1 [element :c] : |
450446
| hash_flow.rb:675:15:675:25 | call to taint : | hash_flow.rb:679:25:679:29 | hash2 [element :d] : |
451447
| hash_flow.rb:677:15:677:25 | call to taint : | hash_flow.rb:679:25:679:29 | hash2 [element :f] : |
452448
| hash_flow.rb:679:12:679:16 | [post] hash1 [element :a] : | hash_flow.rb:691:11:691:15 | hash1 [element :a] : |

0 commit comments

Comments
 (0)