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:
Yukihiro "Matz" Matsumoto
2025-07-18 09:38:51 +09:00
parent 4a7c64fbf8
commit 6864eae728
+1 -1
View File
@@ -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);
}