File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
ruby/ql/lib/codeql/ruby/frameworks Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -87,13 +87,15 @@ class StringPercentCall extends PrintfStyleCall {
87
87
override DataFlow:: Node getFormatString ( ) { result = this .getReceiver ( ) }
88
88
89
89
override DataFlow:: Node getFormatArgument ( int n ) {
90
- exists ( DataFlow:: CallNode arrCall |
91
- arrCall = this .getArgument ( 0 ) and arrCall .getMethodName ( ) = "[]"
92
- |
93
- n = - 2 and // -2 is indicates that the index does not make sense in this context
94
- result = arrCall .getKeywordArgument ( _)
90
+ exists ( Ast:: Call call | call = this .asExpr ( ) .getExpr ( ) |
91
+ exists ( Ast:: ArrayLiteral arrLit | arrLit = call .getArgument ( 0 ) |
92
+ result .asExpr ( ) .getExpr ( ) = arrLit .getElement ( n )
93
+ )
95
94
or
96
- result = arrCall .getArgument ( n )
95
+ exists ( Ast:: HashLiteral hashLit | hashLit = call .getArgument ( 0 ) |
96
+ n = - 2 and // -2 is indicates that the index does not make sense in this context
97
+ result .asExpr ( ) .getExpr ( ) = hashLit .getAnElement ( )
98
+ )
97
99
)
98
100
}
99
101
You can’t perform that action at this time.
0 commit comments