Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Fix a missing `read_string` in wasip1 (#15031)

Alex Crichtonedb507a7d4fe
diff --git a/crates/test-programs/src/bin/p1_cli_hostcall_fuel.rs b/crates/test-programs/src/bin/p1_cli_hostcall_fuel.rs
index ef7e360025..9571537dcd 100644
--- a/crates/test-programs/src/bin/p1_cli_hostcall_fuel.rs
+++ b/crates/test-programs/src/bin/p1_cli_hostcall_fuel.rs
@@ -18,6 +18,10 @@ fn big_string() {
unsafe { wasip1::path_create_directory(dir_fd, &s) },
Err(wasip1::ERRNO_NOMEM)
);
+ assert_eq!(
+ unsafe { wasip1::path_unlink_file(dir_fd, &s) },
+ Err(wasip1::ERRNO_NOMEM)
+ );
}
fn big_iovecs(blocking_mode: BlockingMode) {
diff --git a/crates/wasi/src/p1.rs b/crates/wasi/src/p1.rs
index 7c7fb4a949..13f3ee3d96 100644
--- a/crates/wasi/src/p1.rs
+++ b/crates/wasi/src/p1.rs
@@ -2297,7 +2297,7 @@ impl wasi_snapshot_preview1::WasiSnapshotPreview1 for WasiP1Ctx {
path: GuestPtr<str>,
) -> Result<(), types::Error> {
let dirfd = self.get_dir_fd(dirfd)?;
- let path = memory.as_cow_str(path)?.into_owned();
+ let path = self.read_string(memory, path)?;
self.filesystem()
.unlink_file_at(dirfd.borrowed(), path)
.await?;