summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorUrabe, Shyouhei <shyouhei@ruby-lang.org>2018-09-19 16:46:44 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2019-09-02 13:56:40 +0900
commit79e3d6bb9e007fc97153c1097daf78e9a201a642 (patch)
treebdefaf288d1572b234c7544007af88531cfd366c /vm_insnhelper.c
parentec80d5c4f322b9ae02babd32a491bd05807a8155 (diff)
fix shortcut condition
rb_reg_match expects its first argument to be a Regexp instance. Should check that.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/1959
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 6a198f94e4..1c74b121e8 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -4358,6 +4358,7 @@ static VALUE
vm_opt_regexpmatch2(VALUE recv, VALUE obj)
{
if (CLASS_OF(recv) == rb_cString &&
+ CLASS_OF(obj) == rb_cRegexp &&
BASIC_OP_UNREDEFINED_P(BOP_MATCH, STRING_REDEFINED_OP_FLAG)) {
return rb_reg_match(obj, recv);
}