Previously, `fd_readdir` was truncating directory entry names based on the
calculation of `min(name_len, buf_len - bufused)`, but `bufused` was not being
updated after writing in the `dirent` structure to the buffer.
This allowed `bufused` to be incremented beyond `buf_len` and returned as the
number of bytes written to the buffer, which is invalid.
This fix adjusts `bufused` when the buffer is written to for the `dirent` so
that name truncation happens as expected.
Fixes#2618.
This commit fixes a memory leak that can happen with `Linker::module`
when the provided module is a command. This function creates a closure
but the closure closed over a strong reference to `Store` (and
transitively through any imports provided). Unfortunately a `Store`
keeps everything alive, including `Func`, so this meant that `Store` was
inserted into a cycle which caused the leak.
The cycle here is manually broken by closing over the raw value of each
external value rather than the external value itself (which has a
strong reference to `Store`).
the Rc<RefCell<ctx>> wrapping inside the wasmtime-generated bindings
was eliminated, and instead the caller of ::new(linker, ctx) is
required to wrap the ctx in Rc<RefCell<>>.
The Rc wrapping inside WasiCryptoCtx can be eliminated due to this
change.
the original C implementation was derived directly from cloudabi-utils.
that implementation is no longer in tree.
acfoltzer's initial Rust implementation included a path_open function
that was ported from cloudabi-utils. this rewrite of wasi-common has
completely delegated all path lookup functionality to cap-std (in the
cap-std-sync impls), and cap-std itself has a completely re-designed
method of path resolution.