* vm_insnhelper.c (check_match): Fix SEGV with VM_CHECKMATCH_TYPE_CASE

and class of `pattern` has `method_missing`
  [Bug #8882] [ruby-core:58606]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
sorah 2013-11-29 08:57:02 +00:00
parent 92b4a05e07
commit 205399b0f4
2 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,9 @@
Fri Nov 29 17:53:22 2013 Shota Fukumori <her@sorah.jp>
* vm_insnhelper.c (check_match): Fix SEGV with VM_CHECKMATCH_TYPE_CASE
and class of `pattern` has `method_missing`
[Bug #8882] [ruby-core:58606]
Fri Nov 29 17:06:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_eval.c (rb_yield_block): yield block with rb_block_call_func

View File

@ -947,7 +947,13 @@ check_match(VALUE pattern, VALUE target, enum vm_check_match_type type)
case VM_CHECKMATCH_TYPE_CASE: {
VALUE defined_class;
rb_method_entry_t *me = rb_method_entry_with_refinements(CLASS_OF(pattern), idEqq, &defined_class);
return vm_call0(GET_THREAD(), pattern, idEqq, 1, &target, me, defined_class);
if (me) {
return vm_call0(GET_THREAD(), pattern, idEqq, 1, &target, me, defined_class);
}
else {
/* fallback to funcall (e.g. method_missing) */
return rb_funcall2(pattern, idEqq, 1, &target);
}
}
default:
rb_bug("check_match: unreachable");