bytecodealliance / bytecodealliance/wasmtime

cpp-api: WasmType/Val does not handle endianness conversions from native types on big-endian platforms

Open
#12,784 1 comment 0 reactions 0 assignees View on GitHub
wasmtime:c-api
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

The c-api indicates the [values stored in wasmtime_val_raw_t indicate they must be little-endian](https://github.com/bytecodealliance/wasmtime/blob/554dc00453100c4aa9d9b2557c819ff24e9a7599/crates/c-api/include/wasmtime/val.h#L380).

For the cpp-api, passing native cpp types (such as uint32_t, uint64_t, etc) to [wasmtime::WasmType](https://github.com/bytecodealliance/wasmtime/blob/554dc00453100c4aa9d9b2557c819ff24e9a7599/crates/c-api/include/wasmtime/func.hh#L60-L73) does not perform the endianness conversion on big-endian platforms when storing directly into wasmtime_val_raw_t. I believe wasmtime::Val also needs endianness conversions.

Related: https://github.com/proxy-wasm/proxy-wasm-cpp-host/pull/503#discussion_r2934516888

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.