mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
initialize kw special local var.
A method which has keyword parameters has an implicit local variable to specify which keywords are (un)specified. vm_call_iseq_setup_kwparm_nokwarg() is special function to invoke a ISeq method without any keyword arguments. However, it should also initialize the special local var. Without this initialization, the implicit lvar can points a freed (T_NONE) object.
This commit is contained in:
parent
c5b4d2a259
commit
21f7cca2c6
1 changed files with 4 additions and 1 deletions
|
|
@ -2073,9 +2073,12 @@ vm_call_iseq_setup_kwparm_nokwarg(rb_execution_context_t *ec, rb_control_frame_t
|
||||||
VALUE * const argv = cfp->sp - calling->argc;
|
VALUE * const argv = cfp->sp - calling->argc;
|
||||||
VALUE * const klocals = argv + kw_param->bits_start - kw_param->num;
|
VALUE * const klocals = argv + kw_param->bits_start - kw_param->num;
|
||||||
|
|
||||||
for (int i=0; i<kw_param->num; i++) {
|
int i;
|
||||||
|
for (i=0; i<kw_param->num; i++) {
|
||||||
klocals[i] = kw_param->default_values[i];
|
klocals[i] = kw_param->default_values[i];
|
||||||
}
|
}
|
||||||
|
klocals[i] = INT2FIX(0); // kw specify flag
|
||||||
|
|
||||||
/* NOTE: don't need to setup (clear) unspecified bits
|
/* NOTE: don't need to setup (clear) unspecified bits
|
||||||
because no code check it.
|
because no code check it.
|
||||||
klocals[kw_param->num] = INT2FIX(0); */
|
klocals[kw_param->num] = INT2FIX(0); */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue