diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-09-23 16:02:44 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-09-23 16:02:44 +0900 |
commit | 49af9012a20a824542cf588e55e5488895553e09 (patch) | |
tree | 3f1904881dccb4ea00a57b9bc7d9c073123b5f7d /test/ruby/test_marshal.rb | |
parent | 7cec727612c7b3a3c05b6d9efa16a6d4557d2f47 (diff) | |
download | ruby-49af9012a20a824542cf588e55e5488895553e09.tar.gz |
Prohibit invalid encoding symbols [Bug #18184]
Diffstat (limited to 'test/ruby/test_marshal.rb')
-rw-r--r-- | test/ruby/test_marshal.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index 9eea3c272e..58831f3709 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -814,9 +814,13 @@ class TestMarshal < Test::Unit::TestCase assert_raise(ArgumentError, /\(given 1, expected 0\)/) { ruby2_keywords_test(*[hash2]) } - hash2 = Marshal.load(data.sub(/:\x06K(?=T\z)/, "I\\&\x06:\x0dencoding\"\x0dUTF-16LE")) - assert_raise(ArgumentError, /\(given 1, expected 0\)/) { - ruby2_keywords_test(*[hash2]) + end + + def test_invalid_byte_sequence_symbol + data = Marshal.dump(:K) + data = data.sub(/:\x06K/, "I\\&\x06:\x0dencoding\"\x0dUTF-16LE") + assert_raise(ArgumentError, /UTF-16LE: "\\x4B"/) { + Marshal.load(data) } end |