diff options
author | Nobuyoshi Nakada <[email protected]> | 2025-05-27 22:24:28 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2025-05-29 11:10:58 +0900 |
commit | fa85d23ff4a02985ebfe0716b0ff768f5b4fe13d (patch) | |
tree | 7caac80f68339f5f3ee23ba2abdbc7534719e29a /test/ruby | |
parent | 7082ef201ecf4998d0b4a7a5fd10832a7a3cb18a (diff) |
[Bug #21380] Prohibit modification in String#split block
Reported at https://hackerone.com/reports/3163876
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13462
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_string.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 1011967fe9..138756eac5 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -1869,6 +1869,13 @@ CODE result = []; S("aaa,bbb,ccc,ddd").split(/,/) {|s| result << s.gsub(/./, "A")} assert_equal(["AAA"]*4, result) + + s = S("abc ") * 20 + assert_raise(RuntimeError) { + 10.times do + s.split {s.prepend("xxx" * 100)} + end + } ensure EnvUtil.suppress_warning {$; = fs} end |