diff --git a/CHANGELOG.md b/CHANGELOG.md index 04e2871d1..d322aa03e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file. - Utouch optimizations, rgb i2c init (#20596) ### Fixed +- Berry C mapping, raise an error if too many arguments are sent ### Removed diff --git a/lib/libesp32/berry_mapping/src/be_class_wrapper.c b/lib/libesp32/berry_mapping/src/be_class_wrapper.c index a1abc23ee..2f29ab95a 100644 --- a/lib/libesp32/berry_mapping/src/be_class_wrapper.c +++ b/lib/libesp32/berry_mapping/src/be_class_wrapper.c @@ -360,6 +360,9 @@ int be_check_arg_type(bvm *vm, int arg_start, int argc, const char * arg_type, i } } // berry_log_C(">> be_call_c_func arg %i, type %s", i, arg_type_check ? type_short_name : ""); + if (arg_type_check && type_short_name[0] == 0) { + be_raisef(vm, "value_error", "Too many arguments"); + } p[p_idx] = be_convert_single_elt(vm, i + arg_start, arg_type_check ? type_short_name : NULL, (int*)&buf_len); // berry_log_C("< ret[%i]=%i", p_idx, p[p_idx]); p_idx++;