mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 12:14:51 +00:00
Assert that RARRAY_AREF is within bounds
We should assert that i is within bounds to prevent buffer overflows.
This commit is contained in:
parent
0dc1cd407e
commit
729d602e29
@ -140,6 +140,8 @@ RARRAY_AREF(VALUE ary, long i)
|
|||||||
VALUE val;
|
VALUE val;
|
||||||
RBIMPL_ASSERT_TYPE(ary, RUBY_T_ARRAY);
|
RBIMPL_ASSERT_TYPE(ary, RUBY_T_ARRAY);
|
||||||
|
|
||||||
|
RUBY_ASSERT(i < RARRAY_LEN(ary));
|
||||||
|
|
||||||
RBIMPL_WARNING_PUSH();
|
RBIMPL_WARNING_PUSH();
|
||||||
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ == 13
|
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ == 13
|
||||||
RBIMPL_WARNING_IGNORED(-Warray-bounds);
|
RBIMPL_WARNING_IGNORED(-Warray-bounds);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user