Amanieu edited PR #3582 from c-api-vec
to main
:
While working on https://github.com/wasmerio/wasmer/pull/2683 I noticed a few bugs in wasmtime's implementation of the Wasm C API, specifically the vector types.
The first issue is the incorrect implementation of
Clone
using#[derive]
. This only performs a shallow copy of the vector, which means that you can end up with a double-free once both clones are freed.The second issue is that the
wasm_*_vec_new
functions are supposed to take ownership of objects in the given slice, not clone them. This is apparent if you look at the declaration and how it is used in the C API header.
peterhuene submitted PR review.
Amanieu updated PR #3582 from c-api-vec
to main
.
peterhuene merged PR #3582.
Last updated: Nov 22 2024 at 16:03 UTC