-
Notifications
You must be signed in to change notification settings - Fork 32
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
wasi fd_read sets bogous n_bytes_read value / ignores buffer length on webassembly.sh #112
Comments
Actually, nevermind this being about rust ≥1.57, this occurs with all rust versions for large enough inputs:
This is also happening with other languages/compilers/system libs, they just have less strict checks and probably do some undefined behavior memory access… Nice.
|
I made a little test file to check whether a value directly after the buffer is overwritten, i.e. whether the just the returned Seems only the returned value is wrong, the canary is left intact:
Other than that, this only happens when piping. But I haven't found the code for piping in wasm-terminal, so no idea what's going on. |
The following Rust code panics in webassembly.sh when compiled with rustc ≥ 1.57 (but runs fine on desktop wasmer).
Panic
Quick repro:
echo putatleastthirtytwobyteshereandyouwillsee | ./repro
The failing assert is here. I haven't really looked at how the surrounding code changed, but change it did.
Adding some more debug output to wasi, I get the following with 1.56 on desktop
and the following on 1.57
so I guess the initial buffer size changed and webassembly.sh somehow manages to return the wrong value for
bytes_read
(maybe 42?).The text was updated successfully, but these errors were encountered: