1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

proc: fix super_method segfault after bind

* proc.c: handle undefined iclass
  [ruby-core:85231] [Bug #14421]

From: Eric Wong <e@80x24.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2018-01-30 19:35:12 +00:00
parent 1bb98357c9
commit b10b51225e
2 changed files with 6 additions and 0 deletions

1
proc.c
View file

@ -2725,6 +2725,7 @@ method_super_method(VALUE method)
TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
iclass = data->iclass;
if (!iclass) return Qnil;
super_class = RCLASS_SUPER(RCLASS_ORIGIN(iclass));
mid = data->me->called_id;
if (!super_class) return Qnil;

View file

@ -926,6 +926,11 @@ class TestMethod < Test::Unit::TestCase
assert_equal(m1.source_location, m2.source_location, bug)
end
def test_super_method_after_bind
assert_nil String.instance_method(:length).bind(String.new).super_method,
'[ruby-core:85231] [Bug #14421]'
end
def rest_parameter(*rest)
rest
end