summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-29 08:57:02 +0000
committersorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-29 08:57:02 +0000
commit205399b0f4849bf3f8845b82b6e85416cd68eba2 (patch)
tree5da0e507520c7cf78b9d2a9464fe4b2397245674
parent92b4a05e07de480fabc70dae35c4b6dd2b1f42c9 (diff)
* 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
-rw-r--r--ChangeLog6
-rw-r--r--vm_insnhelper.c8
2 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 1e2b9a8..5e11b17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 9844d47..ad3e6fb 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -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");