Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'fix_negative_array_indexing' of github.com:presidentbee…

…f/brakeman into fix_negative_array_indexing
  • Loading branch information...
commit 4e4a3888ee78267515dbee00f9fe7808532df1c4 2 parents 1a7f3ea + 5560967
@presidentbeef authored
View
6 lib/brakeman/processors/alias_processor.rb
@@ -452,11 +452,7 @@ def process_array_access target, args
index = args[0][1]
#Have to do this because first element is :array and we have to skip it
- if index >= 0
- target[index + 1]
- else
- target[index - 1]
- end
+ target[1..-1][index + 1]
else
nil
end
View
1  test/apps/rails3.1/lib/somelib.rb
@@ -2,5 +2,6 @@ class MyLib
def test_negative_array_index
#This should not cause an error, but it used to
[][-1]
+ [-1][-1]
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.