mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 13:40:37 +00:00
deps: update uvwasi to 0.0.21
PR-URL: https://github.com/nodejs/node/pull/52863 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
a833c9e0be
commit
58a5b3042c
2
deps/uvwasi/include/uvwasi.h
vendored
2
deps/uvwasi/include/uvwasi.h
vendored
@ -11,7 +11,7 @@ extern "C" {
|
||||
|
||||
#define UVWASI_VERSION_MAJOR 0
|
||||
#define UVWASI_VERSION_MINOR 0
|
||||
#define UVWASI_VERSION_PATCH 20
|
||||
#define UVWASI_VERSION_PATCH 21
|
||||
#define UVWASI_VERSION_HEX ((UVWASI_VERSION_MAJOR << 16) | \
|
||||
(UVWASI_VERSION_MINOR << 8) | \
|
||||
(UVWASI_VERSION_PATCH))
|
||||
|
2
deps/uvwasi/src/path_resolver.c
vendored
2
deps/uvwasi/src/path_resolver.c
vendored
@ -269,7 +269,7 @@ static uvwasi_errno_t uvwasi__normalize_relative_path(
|
||||
normalized. */
|
||||
uvwasi_errno_t err;
|
||||
char* combined;
|
||||
char* normalized;
|
||||
char* normalized = NULL;
|
||||
uvwasi_size_t combined_len;
|
||||
uvwasi_size_t fd_path_len;
|
||||
uvwasi_size_t norm_len;
|
||||
|
43
deps/uvwasi/src/uvwasi.c
vendored
43
deps/uvwasi/src/uvwasi.c
vendored
@ -1158,7 +1158,7 @@ uvwasi_errno_t uvwasi_fd_pread(uvwasi_t* uvwasi,
|
||||
offset,
|
||||
nread);
|
||||
|
||||
if (uvwasi == NULL || iovs == NULL || nread == NULL)
|
||||
if (uvwasi == NULL || (iovs == NULL && iovs_len > 0) || nread == NULL || offset > INT64_MAX)
|
||||
return UVWASI_EINVAL;
|
||||
|
||||
err = uvwasi_fd_table_get(uvwasi->fds,
|
||||
@ -1169,6 +1169,14 @@ uvwasi_errno_t uvwasi_fd_pread(uvwasi_t* uvwasi,
|
||||
if (err != UVWASI_ESUCCESS)
|
||||
return err;
|
||||
|
||||
// libuv returns EINVAL in this case. To behave consistently with other
|
||||
// Wasm runtimes, return OK here with a no-op.
|
||||
if (iovs_len == 0) {
|
||||
uv_mutex_unlock(&wrap->mutex);
|
||||
*nread = 0;
|
||||
return UVWASI_ESUCCESS;
|
||||
}
|
||||
|
||||
err = uvwasi__setup_iovs(uvwasi, &bufs, iovs, iovs_len);
|
||||
if (err != UVWASI_ESUCCESS) {
|
||||
uv_mutex_unlock(&wrap->mutex);
|
||||
@ -1282,7 +1290,7 @@ uvwasi_errno_t uvwasi_fd_pwrite(uvwasi_t* uvwasi,
|
||||
offset,
|
||||
nwritten);
|
||||
|
||||
if (uvwasi == NULL || iovs == NULL || nwritten == NULL)
|
||||
if (uvwasi == NULL || (iovs == NULL && iovs_len > 0) || nwritten == NULL || offset > INT64_MAX)
|
||||
return UVWASI_EINVAL;
|
||||
|
||||
err = uvwasi_fd_table_get(uvwasi->fds,
|
||||
@ -1293,6 +1301,14 @@ uvwasi_errno_t uvwasi_fd_pwrite(uvwasi_t* uvwasi,
|
||||
if (err != UVWASI_ESUCCESS)
|
||||
return err;
|
||||
|
||||
// libuv returns EINVAL in this case. To behave consistently with other
|
||||
// Wasm runtimes, return OK here with a no-op.
|
||||
if (iovs_len == 0) {
|
||||
uv_mutex_unlock(&wrap->mutex);
|
||||
*nwritten = 0;
|
||||
return UVWASI_ESUCCESS;
|
||||
}
|
||||
|
||||
err = uvwasi__setup_ciovs(uvwasi, &bufs, iovs, iovs_len);
|
||||
if (err != UVWASI_ESUCCESS) {
|
||||
uv_mutex_unlock(&wrap->mutex);
|
||||
@ -1332,14 +1348,21 @@ uvwasi_errno_t uvwasi_fd_read(uvwasi_t* uvwasi,
|
||||
iovs,
|
||||
iovs_len,
|
||||
nread);
|
||||
|
||||
if (uvwasi == NULL || iovs == NULL || nread == NULL)
|
||||
if (uvwasi == NULL || (iovs == NULL && iovs_len > 0) || nread == NULL)
|
||||
return UVWASI_EINVAL;
|
||||
|
||||
err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_READ, 0);
|
||||
if (err != UVWASI_ESUCCESS)
|
||||
return err;
|
||||
|
||||
// libuv returns EINVAL in this case. To behave consistently with other
|
||||
// Wasm runtimes, return OK here with a no-op.
|
||||
if (iovs_len == 0) {
|
||||
uv_mutex_unlock(&wrap->mutex);
|
||||
*nread = 0;
|
||||
return UVWASI_ESUCCESS;
|
||||
}
|
||||
|
||||
err = uvwasi__setup_iovs(uvwasi, &bufs, iovs, iovs_len);
|
||||
if (err != UVWASI_ESUCCESS) {
|
||||
uv_mutex_unlock(&wrap->mutex);
|
||||
@ -1634,13 +1657,21 @@ uvwasi_errno_t uvwasi_fd_write(uvwasi_t* uvwasi,
|
||||
iovs_len,
|
||||
nwritten);
|
||||
|
||||
if (uvwasi == NULL || iovs == NULL || nwritten == NULL)
|
||||
if (uvwasi == NULL || (iovs == NULL && iovs_len > 0) || nwritten == NULL)
|
||||
return UVWASI_EINVAL;
|
||||
|
||||
err = uvwasi_fd_table_get(uvwasi->fds, fd, &wrap, UVWASI_RIGHT_FD_WRITE, 0);
|
||||
if (err != UVWASI_ESUCCESS)
|
||||
return err;
|
||||
|
||||
// libuv returns EINVAL in this case. To behave consistently with other
|
||||
// Wasm runtimes, return OK here with a no-op.
|
||||
if (iovs_len == 0) {
|
||||
uv_mutex_unlock(&wrap->mutex);
|
||||
*nwritten = 0;
|
||||
return UVWASI_ESUCCESS;
|
||||
}
|
||||
|
||||
err = uvwasi__setup_ciovs(uvwasi, &bufs, iovs, iovs_len);
|
||||
if (err != UVWASI_ESUCCESS) {
|
||||
uv_mutex_unlock(&wrap->mutex);
|
||||
@ -2168,7 +2199,7 @@ uvwasi_errno_t uvwasi_path_readlink(uvwasi_t* uvwasi,
|
||||
|
||||
memcpy(buf, req.ptr, len);
|
||||
buf[len] = '\0';
|
||||
*bufused = len + 1;
|
||||
*bufused = len;
|
||||
uv_fs_req_cleanup(&req);
|
||||
return UVWASI_ESUCCESS;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ int main() {
|
||||
|
||||
assert(0 == symlink(target, linkpath));
|
||||
assert(readlink(linkpath, readlink_result, result_size) ==
|
||||
strlen(target) + 1);
|
||||
strlen(target));
|
||||
assert(0 == strcmp(readlink_result, target));
|
||||
|
||||
FILE* file = fopen(linkpath, "r");
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user