From 937319126af801016d410226eb0cefc2c0b5ed32 Mon Sep 17 00:00:00 2001 From: nagachika Date: Sat, 30 Nov 2024 18:34:32 +0900 Subject: merge revision(s) 02b70256b5171d4b85ea7eeab836d3d7cfb3dbfc, 6b4f8945d600168bf530d21395da8293fbd5e8ba: [Backport #20909] Check negative integer underflow Many of Oniguruma functions need valid encoding strings --- test/ruby/test_string.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/ruby') 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') -- cgit v1.2.3