From 6ae6a8c7bc86e9740850e64125deceb7d8a01fce Mon Sep 17 00:00:00 2001 From: marcandre Date: Wed, 4 Feb 2015 19:03:20 +0000 Subject: * vm_insnhelper.c: Fix symbol leak with +send+ and method_missing [#10828] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_symbol.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb index db0d135b90..5d2e2c3267 100644 --- a/test/ruby/test_symbol.rb +++ b/test/ruby/test_symbol.rb @@ -258,4 +258,20 @@ class TestSymbol < Test::Unit::TestCase 10.times { 42.send "send should not leak #{i} - sym".to_sym rescue nil } end end + + def test_symbol_send_leak_string_custom_method_missing + x = Object.new + def x.method_missing(*); end + assert_no_immortal_symbol_created do + 10.times { |i| x.send "send should not leak #{i} - str mm" } + end + end + + def test_symbol_send_leak_symbol_custom_method_missing + x = Object.new + def x.method_missing(*); end + assert_no_immortal_symbol_created do + 10.times { |i| x.send "send should not leak #{i} - sym mm".to_sym } + end + end end -- cgit v1.2.3