提交 4e4a3888 编写于 作者: J Justin Collins

Merge branch 'fix_negative_array_indexing' of...

Merge branch 'fix_negative_array_indexing' of github.com:presidentbeef/brakeman into fix_negative_array_indexing
...@@ -452,11 +452,7 @@ class Brakeman::AliasProcessor < Brakeman::SexpProcessor ...@@ -452,11 +452,7 @@ class Brakeman::AliasProcessor < Brakeman::SexpProcessor
index = args[0][1] index = args[0][1]
#Have to do this because first element is :array and we have to skip it #Have to do this because first element is :array and we have to skip it
if index >= 0 target[1..-1][index + 1]
target[index + 1]
else
target[index - 1]
end
else else
nil nil
end end
......
...@@ -2,5 +2,6 @@ class MyLib ...@@ -2,5 +2,6 @@ class MyLib
def test_negative_array_index def test_negative_array_index
#This should not cause an error, but it used to #This should not cause an error, but it used to
[][-1] [][-1]
[-1][-1]
end end
end end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册