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 {
8787 override DataFlow:: Node getFormatString ( ) { result = this .getReceiver ( ) }
8888
8989 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+ )
9594 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+ )
9799 )
98100 }
99101
You can’t perform that action at this time.
0 commit comments