Skip to content

wasi: fix serdes bugs from snapshot1 migration #31122

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/node_wasi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -545,15 +545,15 @@ void WASI::FdFilestatGet(const FunctionCallbackInfo<Value>& args) {
ASSIGN_OR_RETURN_UNWRAP(&wasi, args.This());
Debug(wasi, "fd_filestat_get(%d, %d)\n", fd, buf);
GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size);
CHECK_BOUNDS_OR_RETURN(args, mem_size, buf, 56);
CHECK_BOUNDS_OR_RETURN(args, mem_size, buf, 64);
uvwasi_filestat_t stats;
uvwasi_errno_t err = uvwasi_fd_filestat_get(&wasi->uvw_, fd, &stats);

if (err == UVWASI_ESUCCESS) {
wasi->writeUInt64(memory, stats.st_dev, buf);
wasi->writeUInt64(memory, stats.st_ino, buf + 8);
wasi->writeUInt8(memory, stats.st_filetype, buf + 16);
wasi->writeUInt32(memory, stats.st_nlink, buf + 24);
wasi->writeUInt64(memory, stats.st_nlink, buf + 24);
wasi->writeUInt64(memory, stats.st_size, buf + 32);
wasi->writeUInt64(memory, stats.st_atim, buf + 40);
wasi->writeUInt64(memory, stats.st_mtim, buf + 48);
Expand Down Expand Up @@ -1069,7 +1069,7 @@ void WASI::PathFilestatGet(const FunctionCallbackInfo<Value>& args) {
path_len);
GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size);
CHECK_BOUNDS_OR_RETURN(args, mem_size, path_ptr, path_len);
CHECK_BOUNDS_OR_RETURN(args, mem_size, buf_ptr, 56);
CHECK_BOUNDS_OR_RETURN(args, mem_size, buf_ptr, 64);
uvwasi_filestat_t stats;
uvwasi_errno_t err = uvwasi_path_filestat_get(&wasi->uvw_,
fd,
Expand All @@ -1081,7 +1081,7 @@ void WASI::PathFilestatGet(const FunctionCallbackInfo<Value>& args) {
wasi->writeUInt64(memory, stats.st_dev, buf_ptr);
wasi->writeUInt64(memory, stats.st_ino, buf_ptr + 8);
wasi->writeUInt8(memory, stats.st_filetype, buf_ptr + 16);
wasi->writeUInt32(memory, stats.st_nlink, buf_ptr + 24);
wasi->writeUInt64(memory, stats.st_nlink, buf_ptr + 24);
wasi->writeUInt64(memory, stats.st_size, buf_ptr + 32);
wasi->writeUInt64(memory, stats.st_atim, buf_ptr + 40);
wasi->writeUInt64(memory, stats.st_mtim, buf_ptr + 48);
Expand Down Expand Up @@ -1423,7 +1423,7 @@ void WASI::PollOneoff(const FunctionCallbackInfo<Value>& args) {
nsubscriptions,
nevents_ptr);
GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size);
CHECK_BOUNDS_OR_RETURN(args, mem_size, in_ptr, nsubscriptions * 56);
CHECK_BOUNDS_OR_RETURN(args, mem_size, in_ptr, nsubscriptions * 48);
CHECK_BOUNDS_OR_RETURN(args, mem_size, out_ptr, nsubscriptions * 32);
CHECK_BOUNDS_OR_RETURN(args, mem_size, nevents_ptr, 4);
uvwasi_subscription_t* in =
Expand Down