summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-06-28 14:44:01 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-06-28 17:23:32 +0900
commitbc3ac1872e4523334e3ed04c2bb70a55c4c43f98 (patch)
treeb2b1359942b304f7cd763eba3068a05730179b54 /test
parent715c5ca4a41cc4c5e74729b4eed21b9465447d52 (diff)
[Bug #19748] Fix out-of-bound access in `String#byteindex`
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_string.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 215fccfb64..06df67de38 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -3397,6 +3397,9 @@ CODE
assert_byteindex(6, S("にんにちは"), S("に"), 6)
assert_byteindex(6, S("にんにちは"), /に./, 6)
assert_raise(IndexError) { S("にんにちは").byteindex(?に, 7) }
+
+ s = S("foobarbarbaz")
+ assert !1000.times.any? {s.byteindex("", 100_000_000)}
end
def test_byterindex