nodejs / uvwasi

WASI syscall API built atop libuv
MIT License
226 stars 51 forks source link

No-op instead of error on empty read/write #261

Closed yagehu closed 5 months ago

yagehu commented 5 months ago

This commit inserts a special case to fd_{read,write,pread,pwrite} such that passing in an empty list of buffers results in a no-op. This behavior is consistent with Linux host as well as other Wasm runtimes.

fixes #260

yagehu commented 5 months ago

Some allocators return NULL if the size is 0, causing uvwasi__setup_iovs to think allocation has failed. I've moved the len == 0 checks before uvwasi__setup_iovs.

@guybedford @mhdawson Thanks for the review. The PR is ready again.