Stream: git-wasmtime

Topic: wasmtime / Issue #2131 wasm_name_new_from_string should n...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 13 2020 at 19:11):

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 by wasm_name_new_from_string adding to the length.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 13 2020 at 19:11):

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 by wasm_name_new_from_string adding to the length.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 29 2020 at 20:01):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2020 at 18:20):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2020 at 18:21):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2020 at 18:22):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2020 at 18:22):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 13 2021 at 04:08):

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 by wasm_name_new_from_string adding to the length.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 14 2021 at 15:36):

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 by wasm_name_new_from_string adding to the length.


Last updated: Dec 23 2024 at 12:05 UTC