File tree 2 files changed +15
-3
lines changed
lib/codeql/ruby/frameworks/core
test/library-tests/dataflow/hash-flow
2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ private import codeql.ruby.DataFlow
6
6
private import codeql.ruby.ast.internal.Module
7
7
private import codeql.ruby.dataflow.FlowSummary
8
8
private import codeql.ruby.dataflow.internal.DataFlowDispatch
9
+ private import codeql.ruby.typetracking.TypeTrackerSpecific
9
10
10
11
/** An array index that may be tracked precisely in data flow. */
11
12
private class ArrayIndex extends int {
@@ -2471,6 +2472,20 @@ module Enumerable {
2471
2472
}
2472
2473
}
2473
2474
2475
+ private class FilterTypeTrackingStep extends TypeTrackingStep {
2476
+ override predicate withContentStep ( Node pred , Node succ , ContentFilter filter ) {
2477
+ // Type-tracking cannot currently handle the `WithoutElement[0..!].WithElement[any]`
2478
+ // sequence with full precision, so manually add it as a `WithContent` step.
2479
+ exists ( DataFlow:: CallNode call |
2480
+ call .asExpr ( ) .getExpr ( ) =
2481
+ [ any ( SelectSummary s ) .getACallSimple ( ) , any ( RejectSummary s ) .getACallSimple ( ) ] and
2482
+ pred = call .getReceiver ( ) and
2483
+ succ = call and
2484
+ filter = ContentFilter:: hasElements ( )
2485
+ )
2486
+ }
2487
+ }
2488
+
2474
2489
private class SliceBeforeAfterSummary extends SimpleSummarizedCallable {
2475
2490
SliceBeforeAfterSummary ( ) { this = [ "slice_before" , "slice_after" ] }
2476
2491
Original file line number Diff line number Diff line change 11
11
| hash_flow.rb:219:27:219:47 | # $ hasValueFlow=14.2 | Missing result:hasValueFlow=14.2 |
12
12
| hash_flow.rb:291:10:291:14 | ...[...] | Unexpected result: hasValueFlow=19.1 |
13
13
| hash_flow.rb:294:10:294:14 | ...[...] | Unexpected result: hasValueFlow=19.3 |
14
- | hash_flow.rb:351:18:351:38 | # $ hasValueFlow=22.1 | Missing result:hasValueFlow=22.1 |
15
14
| hash_flow.rb:396:18:396:38 | # $ hasValueFlow=25.1 | Missing result:hasValueFlow=25.1 |
16
15
| hash_flow.rb:453:22:453:42 | # $ hasValueFlow=27.3 | Missing result:hasValueFlow=27.3 |
17
16
| hash_flow.rb:455:22:455:42 | # $ hasValueFlow=27.4 | Missing result:hasValueFlow=27.4 |
18
17
| hash_flow.rb:467:16:467:36 | # $ hasValueFlow=28.1 | Missing result:hasValueFlow=28.1 |
19
- | hash_flow.rb:482:16:482:36 | # $ hasValueFlow=29.1 | Missing result:hasValueFlow=29.1 |
20
18
| hash_flow.rb:497:16:497:36 | # $ hasValueFlow=30.1 | Missing result:hasValueFlow=30.1 |
21
19
| hash_flow.rb:513:22:513:42 | # $ hasValueFlow=31.1 | Missing result:hasValueFlow=31.1 |
22
20
| hash_flow.rb:515:10:515:20 | ( ... ) | Unexpected result: hasValueFlow=31.3 |
23
21
| hash_flow.rb:515:22:515:42 | # $ hasValueFlow=31.2 | Missing result:hasValueFlow=31.2 |
24
- | hash_flow.rb:529:18:529:38 | # $ hasValueFlow=32.1 | Missing result:hasValueFlow=32.1 |
25
22
| hash_flow.rb:559:17:559:57 | # $ hasValueFlow=34.1 $ hasValueFlow=34.2 | Missing result:hasValueFlow=34.1 |
26
23
| hash_flow.rb:559:17:559:57 | # $ hasValueFlow=34.1 $ hasValueFlow=34.2 | Missing result:hasValueFlow=34.2 |
27
24
| hash_flow.rb:571:18:571:38 | # $ hasValueFlow=35.1 | Missing result:hasValueFlow=35.1 |
You can’t perform that action at this time.
0 commit comments