summaryrefslogtreecommitdiff
path: root/test/ruby/test_string.rb
diff options
context:
space:
mode:
authornagachika <[email protected]>2025-06-15 12:51:29 +0900
committernagachika <[email protected]>2025-06-15 12:51:29 +0900
commit8908cb07829628115f7455508c2d5885ac99c939 (patch)
tree0db7bdcf17c9763966adb9309230bb103b8cc94c /test/ruby/test_string.rb
parenta205407e165e4570b8b6d6e4b7a019b51962ecba (diff)
merge revision(s) fa85d23ff4a02985ebfe0716b0ff768f5b4fe13d: [Backport #21380]ruby_3_3
[Bug #21380] Prohibit modification in String#split block Reported at https://hackerone.com/reports/3163876
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r--test/ruby/test_string.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index a916781fe8..41a6a40003 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -1908,6 +1908,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