-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wasm_name_new_from_string should not have +1 since rust strings are not null terminated. #2131
Comments
Sorry for the delay in getting to this, but thanks for the report! This is a discrepancy with the upstream C API in https://github.com/WebAssembly/wasm-c-api. The problem is that some string lengths include the nul terminator and some do not. Most Wasmtime APIs do not take into account the nul terminator, except for those that the wasm-c-api specifies should do so. Depending on the constructor you use you get a +1 or not as well. It's pretty confusing, but at this time the upstream C API needs to change to make the situation better I believe. |
WebAssembly/wasm-c-api#151 was made to help distinguish the fact that this function (renamed to We should update our API to match the new name, at which time |
This commit updates the WebAssembly C API submodule (for `wasm.h`) to the latest commit out of master. This fixes the behavior of `wasm_name_new_from_string` such that it no longer copies the null character into the name, which caused unexpected failures when using the Wasmtime linker as imports wouldn't resolve when the null was present. Along with this change were breaking changes to `wasm_func_call`, the host callback signatures, and `wasm_instance_new` to take a vector type instead of a pointer to an unsized array. As a result, Wasmtime language bindings based on the C API will need to be updated once this change is pulled in. Fixes bytecodealliance#2211. Fixes bytecodealliance#2131.
* Update WebAssembly C API submodule to latest commit. This commit updates the WebAssembly C API submodule (for `wasm.h`) to the latest commit out of master. This fixes the behavior of `wasm_name_new_from_string` such that it no longer copies the null character into the name, which caused unexpected failures when using the Wasmtime linker as imports wouldn't resolve when the null was present. Along with this change were breaking changes to `wasm_func_call`, the host callback signatures, and `wasm_instance_new` to take a vector type instead of a pointer to an unsized array. As a result, Wasmtime language bindings based on the C API will need to be updated once this change is pulled in. Fixes #2211. Fixes #2131. * Update Doxygen comments for wasm.h changes.
first one didnt work when adding to the linker.
second one did.
Issue was caused by
wasm_name_new_from_string
adding to the length.The text was updated successfully, but these errors were encountered: