From 52cdf400efaecc0f5e1d1f70f22dc45212e03c4c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 11 Feb 2020 11:28:31 +0900 Subject: Workaround of instance variable on hidden object Since 9d9aea7fe50f6340829faa105d9ffe08ebaee658, generic instance variables need `iv_index_tbl` in the object's class. As hidden objects, however, have no class, access to the variables causes a segfault. Get rid of that segfault by raising an exception, for the time being. --- test/ruby/test_encoding.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/ruby/test_encoding.rb b/test/ruby/test_encoding.rb index 282ac6b1ae..6d0665ae93 100644 --- a/test/ruby/test_encoding.rb +++ b/test/ruby/test_encoding.rb @@ -65,6 +65,18 @@ class TestEncoding < Test::Unit::TestCase END; end + def test_extra_encoding + assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") + begin; + 200.times {|i| + Encoding::UTF_8.replicate("dummy#{i}") + } + e = Encoding.list.last + format = "%d".force_encoding(e) + assert_raise(TypeError) {format % 0} + end; + end + def test_dummy_p assert_equal(true, Encoding::ISO_2022_JP.dummy?) assert_equal(false, Encoding::UTF_8.dummy?) -- cgit v1.2.3