Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit b1fb18e

Browse files
authored
fix incorrect count calculation for host->guest stream writes (#91)
This also updates the `wit-bindgen` dep to pull in an alignment fix. Fixes #85 Signed-off-by: Joel Dice <joel.dice@fermyon.com>
1 parent 26e299f commit b1fb18e

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ io-lifetimes = { version = "2.0.3", default-features = false }
301301
io-extras = "0.18.1"
302302
rustix = "0.38.43"
303303
# TODO: switch back to release:
304-
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "3df706cf", default-features = false }
305-
wit-bindgen-rt = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "3df706cf", default-features = false }
306-
wit-bindgen-rust-macro = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "3df706cf", default-features = false }
304+
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "ec56282b", default-features = false }
305+
wit-bindgen-rt = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "ec56282b", default-features = false }
306+
wit-bindgen-rust-macro = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "ec56282b", default-features = false }
307307

308308
# wasm-tools family:
309309
# TODO: switch back to release:

crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ fn accept<T: func::Lower + Send + Sync + 'static, B: Buffer<T>, U>(
143143
.and_then(|b| b.get_mut(..T::SIZE32 * count))
144144
.ok_or_else(|| anyhow::anyhow!("read pointer out of bounds of memory"))?;
145145

146-
let count = values.len().min(usize::try_from(count).unwrap());
146+
let count = (values.len() - offset).min(usize::try_from(count).unwrap());
147147

148148
if let Some(ty) = payload(ty, types) {
149149
T::store_list(lower, ty, address, &values[offset..][..count])?;

0 commit comments

Comments
 (0)