Skip to content

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

@cpetig

Description

@cpetig

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.

Metadata

Metadata

Assignees

Labels

gen-cppRelated to the C++ code generator

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions