craigsteyn opened Issue #2131:
wasm_name_t nameWrong; wasm_name_new_from_string(&nameWrong, "hello"); wasm_name_t nameRight; wasm_name_new(&nameRight, strlen("hello"), "hello");
first one didnt work when adding to the linker.
second one did.
Issue was caused bywasm_name_new_from_string
adding to the length.
craigsteyn labeled Issue #2131:
wasm_name_t nameWrong; wasm_name_new_from_string(&nameWrong, "hello"); wasm_name_t nameRight; wasm_name_new(&nameRight, strlen("hello"), "hello");
first one didnt work when adding to the linker.
second one did.
Issue was caused bywasm_name_new_from_string
adding to the length.
alexcrichton commented on Issue #2131:
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.
peterhuene commented on Issue #2131:
https://github.com/WebAssembly/wasm-c-api/pull/151 was made to help distinguish the fact that this function will add a null terminator to the string, which makes it unsuitable for a use such as resolving module imports.
We should update our API to match the new name.
peterhuene edited a comment on Issue #2131:
https://github.com/WebAssembly/wasm-c-api/pull/151 was made to help distinguish the fact that this function will add a null terminator to the string, which makes it unsuitable for a use such as resolving module imports.
We should update our API to match the new name, at which time
wasm_name_new_from_string
should start working.
peterhuene edited a comment on Issue #2131:
https://github.com/WebAssembly/wasm-c-api/pull/151 was made to help distinguish the fact that this function (renamed to
wasm_name_new_from_string_nt
will add a null terminator to the string, which makes it unsuitable for a use such as resolving module imports.We should update our API to match the new name, at which time
wasm_name_new_from_string
should start working.
peterhuene edited a comment on Issue #2131:
https://github.com/WebAssembly/wasm-c-api/pull/151 was made to help distinguish the fact that this function (renamed to
wasm_name_new_from_string_nt
) will add a null terminator to the string, which makes it unsuitable for a use such as resolving module imports.We should update our API to match the new name, at which time
wasm_name_new_from_string
should start working.
peterhuene assigned Issue #2131 (assigned to peterhuene):
wasm_name_t nameWrong; wasm_name_new_from_string(&nameWrong, "hello"); wasm_name_t nameRight; wasm_name_new(&nameRight, strlen("hello"), "hello");
first one didnt work when adding to the linker.
second one did.
Issue was caused bywasm_name_new_from_string
adding to the length.
alexcrichton closed Issue #2131 (assigned to peterhuene):
wasm_name_t nameWrong; wasm_name_new_from_string(&nameWrong, "hello"); wasm_name_t nameRight; wasm_name_new(&nameRight, strlen("hello"), "hello");
first one didnt work when adding to the linker.
second one did.
Issue was caused bywasm_name_new_from_string
adding to the length.
Last updated: Dec 23 2024 at 12:05 UTC