bytecodealliance / bytecodealliance/wit-bindgen

C++: Non-canonical lists lowering reuses the C++ result vector

Open
#1,592 5 comments 1 reaction 1 assignee Claimed by @cpetig View on GitHub
gen-cpp
Dominant language
Rust
Stars
1.5k
Forks
286
Avg merge
6h 32m
Merged PRs (30d)
19

Description

This can be seen in the `tests/runtime/lists` example, in function `wasi_http_headers_roundtrip`.

Here the C++ result vector storage is also used to lower the elements. These types may or may not have the same size and might disagree on layout. For sure in-depth copying and overwriting the elements in place is not a good idea. The lowered result should be allocated before the copy and the lifted result array freed after the copy. I only found this because my compiler had a different idea of the C++ type layout.

This error is subtle and doesn't show up in the test.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.