diff --git a/core/iwasm/aot/aot_runtime.c b/core/iwasm/aot/aot_runtime.c index bc0961de..dd05c94c 100644 --- a/core/iwasm/aot/aot_runtime.c +++ b/core/iwasm/aot/aot_runtime.c @@ -2300,7 +2300,7 @@ invoke_wasm_c_api_native(AOTModuleInstance *module_inst, void *func_ptr, } if (trap) { if (trap->message->data) { - snprintf(fmt, sizeof(fmt), "%%%us", (uint32)trap->message->size); + snprintf(fmt, sizeof(fmt), "%%.%us", (uint32)trap->message->size); snprintf(module_inst->cur_exception, sizeof(module_inst->cur_exception), fmt, trap->message->data); diff --git a/core/iwasm/common/wasm_runtime_common.c b/core/iwasm/common/wasm_runtime_common.c index 1999dacb..91ae8457 100644 --- a/core/iwasm/common/wasm_runtime_common.c +++ b/core/iwasm/common/wasm_runtime_common.c @@ -835,7 +835,7 @@ wasm_runtime_destroy_thread_env() { #if WASM_ENABLE_AOT != 0 #ifdef OS_ENABLE_HW_BOUND_CHECK - return aot_signal_destroy(); + aot_signal_destroy(); #endif #endif } diff --git a/core/shared/platform/windows/win_thread.c b/core/shared/platform/windows/win_thread.c index 86dc9fa3..221214bd 100644 --- a/core/shared/platform/windows/win_thread.c +++ b/core/shared/platform/windows/win_thread.c @@ -141,7 +141,7 @@ os_thread_cleanup(void *retval) BH_FREE(thread_data); } -static unsigned +static unsigned __stdcall os_thread_wrapper(void *arg) { os_thread_data *thread_data = arg; diff --git a/samples/wasm-c-api/src/trap.c b/samples/wasm-c-api/src/trap.c index 3074df93..2829dd2e 100644 --- a/samples/wasm-c-api/src/trap.c +++ b/samples/wasm-c-api/src/trap.c @@ -92,6 +92,7 @@ int main(int argc, const char* argv[]) { // Call. for (int i = 0; i < 2; ++i) { + char buf[32]; const wasm_func_t* func = wasm_extern_as_func(exports.data[i]); if (func == NULL) { printf("> Error accessing export!\n"); @@ -109,7 +110,8 @@ int main(int argc, const char* argv[]) { printf("Printing message...\n"); own wasm_name_t message; wasm_trap_message(trap, &message); - printf("> %s\n", message.data); + snprintf(buf, sizeof(buf), "> %%.%us\n", (unsigned)message.size); + printf(buf, message.data); wasm_trap_delete(trap); wasm_name_delete(&message);