mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-11 12:11:14 +00:00
fix(wasm-c-api): Do not clone stack frames if there's no trap (#3008)
When running the wasi-threads no_pthread sample, the assert was failing on `src->num_elems != 0` in debug mode, it is because that the exception is `proc_exit`, there is no trap (the execution didn't fail, no stack frames): https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/samples/wasi-threads/wasm-apps/no_pthread.c
This commit is contained in:
parent
837b9904f5
commit
892a94fd05
|
@ -1924,14 +1924,16 @@ wasm_frame_func_offset(const wasm_frame_t *frame)
|
|||
void
|
||||
wasm_frame_vec_clone_internal(Vector *src, Vector *out)
|
||||
{
|
||||
bh_assert(src->num_elems != 0 && src->data);
|
||||
|
||||
bh_vector_destroy(out);
|
||||
if (!bh_vector_init(out, src->num_elems, sizeof(WASMCApiFrame), false)) {
|
||||
if (src->num_elems == 0) {
|
||||
bh_vector_destroy(out);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!bh_vector_destroy(out)
|
||||
|| !bh_vector_init(out, src->num_elems, sizeof(WASMCApiFrame), false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
bh_memcpy_s(out->data, src->num_elems * sizeof(WASMCApiFrame), src->data,
|
||||
src->num_elems * sizeof(WASMCApiFrame));
|
||||
out->num_elems = src->num_elems;
|
||||
|
|
Loading…
Reference in New Issue
Block a user