From 838dd81e682249fbd2d7ee16d6999dafb87481b9 Mon Sep 17 00:00:00 2001 From: James Ring Date: Wed, 27 Nov 2024 19:50:44 -0800 Subject: [PATCH] don't return an uninitialized trap if argv_to_results fails (#3935) Currently, if argv_to_results fails (e.g. because an unsupported type is encountered), an non-null trap with an uninitialized message is returned. --- core/iwasm/common/wasm_c_api.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/iwasm/common/wasm_c_api.c b/core/iwasm/common/wasm_c_api.c index 500f99dc8b..d5c45a4413 100644 --- a/core/iwasm/common/wasm_c_api.c +++ b/core/iwasm/common/wasm_c_api.c @@ -3442,6 +3442,8 @@ wasm_func_call(const wasm_func_t *func, const wasm_val_vec_t *params, if (result_count) { if (!argv_to_results(argv, wasm_functype_results(func->type), results)) { + wasm_runtime_set_exception(func->inst_comm_rt, + "argv_to_results failed"); goto failed; } results->num_elems = result_count;