summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2025-01-14 17:50:24 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2025-01-14 17:50:24 -0800
commit1e48631e0f318a3b73cd39bdbda4619017383aac (patch)
treed7cb2c5769f45d1c4f15273842ce11c5585e1c1c /test/ruby
parent8506fdfb4aca5262940b9c49827c2a839f6bb1fe (diff)
merge revision(s) 02b70256b5171d4b85ea7eeab836d3d7cfb3dbfc, 6b4f8945d600168bf530d21395da8293fbd5e8ba: [Backport #20909]
Check negative integer underflow Many of Oniguruma functions need valid encoding strings
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_string.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index dcb81cfc6d..a916781fe8 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -169,6 +169,15 @@ CODE
assert_raise(ArgumentError) { "foo"[] }
end
+ def test_AREF_underflow
+ require "rbconfig/sizeof"
+ assert_equal(nil, S("\u{3042 3044 3046}")[RbConfig::LIMITS["LONG_MIN"], 1])
+ end
+
+ def test_AREF_invalid_encoding
+ assert_equal(S("\x80"), S("A"*39+"\x80")[-1, 1])
+ end
+
def test_ASET # '[]='
s = S("FooBar")
s[0] = S('A')