diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-05-04 22:17:04 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-05-12 13:57:15 +0900 |
commit | 8b9b150512b7b9514143a6b971992c9a539ead2f (patch) | |
tree | 0fb4bfcae1e1e4c6a3938c785998bcd52c7e3aa2 /test/ruby | |
parent | d9e6e6fb60ae71f5288f54f0d34fad1e8806cf67 (diff) |
[Bug #20481] Check for unmarshaling ivar
Prohibit setting instance variables of existing classes and modules
via link.
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_marshal.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index 69e92488f2..bcd8892f23 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -571,12 +571,18 @@ class TestMarshal < Test::Unit::TestCase assert_raise(TypeError) {Marshal.load("\x04\x08Ic\x1bTestMarshal::TestClass\x06:\x0e@ivar_bug\"\x08bug")} assert_raise(TypeError) {Marshal.load("\x04\x08IM\x1bTestMarshal::TestClass\x06:\x0e@ivar_bug\"\x08bug")} assert_not_operator(TestClass, :instance_variable_defined?, :@ivar_bug) + + assert_raise(TypeError) {Marshal.load("\x04\x08[\x07c\x1bTestMarshal::TestClassI@\x06\x06:\x0e@ivar_bug\"\x08bug")} + assert_not_operator(TestClass, :instance_variable_defined?, :@ivar_bug) end def test_module_ivar assert_raise(TypeError) {Marshal.load("\x04\x08Im\x1cTestMarshal::TestModule\x06:\x0e@ivar_bug\"\x08bug")} assert_raise(TypeError) {Marshal.load("\x04\x08IM\x1cTestMarshal::TestModule\x06:\x0e@ivar_bug\"\x08bug")} assert_not_operator(TestModule, :instance_variable_defined?, :@ivar_bug) + + assert_raise(TypeError) {Marshal.load("\x04\x08[\x07m\x1cTestMarshal::TestModuleI@\x06\x06:\x0e@ivar_bug\"\x08bug")} + assert_not_operator(TestModule, :instance_variable_defined?, :@ivar_bug) end class TestForRespondToFalse |