Skip to content

Commit

Permalink
argv may be modified when mrb_funcall() is called; fix #3419
Browse files Browse the repository at this point in the history
Calling `mrb_funcall()` and `mrb_yield()` (and their related
functions) are discouraged unless absolutely necessary, because
it can cause this kind of issues very easily.
  • Loading branch information
matz committed Feb 4, 2017
1 parent 8f52b88 commit bf4e79c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,11 @@ mrb_obj_extend_m(mrb_state *mrb, mrb_value self)
{
mrb_value *argv;
mrb_int argc;
mrb_value args;

mrb_get_args(mrb, "*", &argv, &argc);
args = mrb_ary_new_from_values(mrb, argc, argv);
argv = (mrb_value*)RARRAY_PTR(args);
return mrb_obj_extend(mrb, argc, argv, self);
}

Expand Down

0 comments on commit bf4e79c

Please sign in to comment.