You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fd_seek with whence set to set and a negative should error. It is the case on Linux host and other Wasm runtimes. However, Wasmer happily cast the negative offset to an unsigned offset and performs the seek.
fnmain(){unsafe{let result = wasi::fd_seek(4, -1, wasi::WHENCE_SET);match result {Ok(new_offset) => eprintln!("fd_seek ok new offset {new_offset}"),Err(errno) => eprintln!("fd_seek errno {errno}"),}}}
Compile this snippet to wasm32-wasi and run it with wasmer.
Expected behavior
The above snippet should print fd_seek errno INVAL (error 28).
Actual behavior
fd_seek ok new offset 18446744073709551615
Additional context
I have a fix. Will submit a PR.
The text was updated successfully, but these errors were encountered:
yagehu
added a commit
to yagehu/wasmer
that referenced
this issue
Apr 12, 2024
This commit fixes [wasmerio#4556][1]. Passing in a negative offset along with
`whence::set` causes wasmer to erroneously seek to a very large offset.
[1]: wasmerio#4556
This commit fixes [wasmerio#4556][1]. Passing in a negative offset along with
`whence::set` causes wasmer to erroneously seek to a very large offset.
[1]: wasmerio#4556
This commit fixes [#4556][1]. Passing in a negative offset along with
`whence::set` causes wasmer to erroneously seek to a very large offset.
[1]: #4556
Describe the bug
fd_seek
withwhence
set toset
and a negative should error. It is the case on Linux host and other Wasm runtimes. However, Wasmer happily cast the negative offset to an unsigned offset and performs the seek.$ wasmer -vV; rustc -vV wasmer 4.2.8 (fe3c6d0 2024-04-11) binary: wasmer-cli commit-hash: fe3c6d0461f2ee646fd38d1d6480d7c3a30fec74 commit-date: 2024-04-11 host: x86_64-unknown-linux-gnu compiler: singlepass,cranelift rustc 1.77.1 (7cf61ebde 2024-03-27) binary: rustc commit-hash: 7cf61ebde7b22796c69757901dd346d0fe70bd97 commit-date: 2024-03-27 host: x86_64-unknown-linux-gnu release: 1.77.1 LLVM version: 17.0.6
Steps to reproduce
Compile this snippet to
wasm32-wasi
and run it with wasmer.Expected behavior
The above snippet should print
fd_seek errno INVAL (error 28)
.Actual behavior
Additional context
I have a fix. Will submit a PR.
The text was updated successfully, but these errors were encountered: