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

fix shortcut condition

rb_reg_match expects its first argument to be a Regexp instance.
Should check that.
This commit is contained in:
Urabe, Shyouhei 2018-09-19 16:46:44 +09:00 committed by Takashi Kokubun
parent ec80d5c4f3
commit 79e3d6bb9e
Notes: git 2019-09-02 13:57:07 +09:00

View file

@ -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);
}