diff options
| author | nagachika <nagachika@ruby-lang.org> | 2024-11-30 18:34:32 +0900 |
|---|---|---|
| committer | nagachika <nagachika@ruby-lang.org> | 2024-11-30 18:34:32 +0900 |
| commit | 937319126af801016d410226eb0cefc2c0b5ed32 (patch) | |
| tree | 013f131aa23005b4f9cce66477c291bcc7992275 /test/ruby | |
| parent | 87249cbddb5dbac16cb7f0fa33958a42389759cb (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.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 24527a527f..f4ef6ccb6b 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -162,6 +162,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') |
