From 6864eae728eabd22437a609013edf7f3ec369d6a Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Fri, 18 Jul 2025 09:38:51 +0900 Subject: [PATCH] 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 --- mrbgems/mruby-struct/src/struct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mrbgems/mruby-struct/src/struct.c b/mrbgems/mruby-struct/src/struct.c index e25843741..01575d2fc 100644 --- a/mrbgems/mruby-struct/src/struct.c +++ b/mrbgems/mruby-struct/src/struct.c @@ -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); }