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
Cloneusing#[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_newfunctions 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: Dec 06 2025 at 06:05 UTC