diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-01-20 00:41:56 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-01-25 14:06:38 +0900 |
commit | 0c436bbfbf3b28fab8abfcbda9b8f388fa22290a (patch) | |
tree | 44cb3e073c7583d245404150a6790dfa4f0a7840 /test/ruby/test_array.rb | |
parent | 2b2821acd39530c6c786e34f304e9e018a31e5c4 (diff) |
Recheck array length after `to_str` conversion
https://hackerone.com/reports/244787
Diffstat (limited to 'test/ruby/test_array.rb')
-rw-r--r-- | test/ruby/test_array.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index c3b842e950..fcfda92487 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -2457,6 +2457,17 @@ class TestArray < Test::Unit::TestCase assert_equal("ab012z", x.ary.join("")) end + def test_join_recheck_array_length + x = Struct.new(:ary).new + def x.to_str + ary.clear + ary[0] = "b" + "z" + end + x.ary = Array.new(1023) {"a"*1} << x + assert_equal("b", x.ary.join("")) + end + def test_to_a2 klass = Class.new(Array) a = klass.new.to_a |