mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-struct: replace mrb_funcall with mrb_ary_join to avoid VM callbacks
Replace mrb_funcall_id call with direct mrb_ary_join function call in error message generation to comply with VM callback restrictions. This prevents re-entrant VM execution which can cause crashes and undefined behavior, following mruby's policy of avoiding VM callbacks from C code. Co-authored-by: Atlassian Rovo Dev
This commit is contained in:
@@ -381,7 +381,7 @@ mrb_struct_initialize_withKw(mrb_state *mrb, mrb_value hash, mrb_value self)
|
||||
|
||||
/* If there are any invalid keys, raise an error with all of them */
|
||||
if (RARRAY_LEN(invalid_keys) > 0) {
|
||||
mrb_value keys_str = mrb_funcall_id(mrb, invalid_keys, MRB_SYM(join), 1, mrb_str_new_lit(mrb, ", "));
|
||||
mrb_value keys_str = mrb_ary_join(mrb, invalid_keys, mrb_str_new_lit(mrb, ", "));
|
||||
mrb_raisef(mrb, E_ARGUMENT_ERROR, "unknown keywords: %S", keys_str);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user