-
Notifications
You must be signed in to change notification settings - Fork 256
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
Incorrect size returned by __wasi_environ_sizes_get #27
Comments
The C arrays exposed to user code for I agree it is currently unclear whether the NULL termination is the responsibility of the __wasi_environ_get/__wasi_args_get syscalls, or of the calling code (i.e. the code in crt1.c). |
recently tripped me up as well while implementing this |
Based on @sunfishcode's earlier comment, I think it's best to not force WASI into a convention that might be viewed as an implementation detail for a libc implementation. I've put up #128 so we can discuss this further. |
Thank you @leonwanghui for pointing this out in WebAssembly#26
The documentation for
__wasi_environ_get
says "The sizes of the buffers should match that returned by__wasi_environ_sizes_get
" but the WASI implementations that I tested (wasmtime and wasmer) expect a buffer with space for additional null pointer at the end. The sysroot too implements it that way.This is in contrast with
__wasi_args_get
and__wasi_args_sizes_get
that say the same thing but do as documented.I'm not sure if this is a bug or the expected behavior. If it is, it should be documented as such.
The text was updated successfully, but these errors were encountered: