diff options
author | Colin Ihrig <cjihrig@gmail.com> | 2021-11-20 15:07:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-20 20:07:13 +0000 |
commit | e10085a03bdb164abb83358ae3f30fdad513e92b (patch) | |
tree | 4367751ef3c39fa3c3b4801492bdd13cd9b76f5f /deps/uvwasi | |
parent | a37b9c80ef837de5fc99d750c3597d32ad3814b0 (diff) | |
download | node-new-e10085a03bdb164abb83358ae3f30fdad513e92b.tar.gz |
deps: update to uvwasi 0.0.12
Notable changes:
- Several overflows have been fixed.
- The libuv dependency has been updated to v1.42.0.
PR-URL: https://github.com/nodejs/node/pull/40847
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'deps/uvwasi')
-rw-r--r-- | deps/uvwasi/include/uvwasi.h | 4 | ||||
-rw-r--r-- | deps/uvwasi/include/wasi_types.h | 2 | ||||
-rw-r--r-- | deps/uvwasi/src/clocks.c | 24 | ||||
-rw-r--r-- | deps/uvwasi/src/fd_table.c | 2 | ||||
-rw-r--r-- | deps/uvwasi/src/fd_table.h | 2 | ||||
-rw-r--r-- | deps/uvwasi/src/uvwasi.c | 5 |
6 files changed, 21 insertions, 18 deletions
diff --git a/deps/uvwasi/include/uvwasi.h b/deps/uvwasi/include/uvwasi.h index d093a412d6..28d3856861 100644 --- a/deps/uvwasi/include/uvwasi.h +++ b/deps/uvwasi/include/uvwasi.h @@ -10,7 +10,7 @@ extern "C" { #define UVWASI_VERSION_MAJOR 0 #define UVWASI_VERSION_MINOR 0 -#define UVWASI_VERSION_PATCH 11 +#define UVWASI_VERSION_PATCH 12 #define UVWASI_VERSION_HEX ((UVWASI_VERSION_MAJOR << 16) | \ (UVWASI_VERSION_MINOR << 8) | \ (UVWASI_VERSION_PATCH)) @@ -68,7 +68,7 @@ typedef struct uvwasi_options_s { } uvwasi_options_t; /* Embedder API. */ -uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, uvwasi_options_t* options); +uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, const uvwasi_options_t* options); void uvwasi_destroy(uvwasi_t* uvwasi); void uvwasi_options_init(uvwasi_options_t* options); /* Use int instead of uv_file to avoid needing uv.h */ diff --git a/deps/uvwasi/include/wasi_types.h b/deps/uvwasi/include/wasi_types.h index 57c2dd2f3c..35e46a821b 100644 --- a/deps/uvwasi/include/wasi_types.h +++ b/deps/uvwasi/include/wasi_types.h @@ -4,7 +4,7 @@ #include <stddef.h> #include <stdint.h> -/* API: https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/docs.md */ +/* API: https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md */ typedef uint32_t uvwasi_size_t; diff --git a/deps/uvwasi/src/clocks.c b/deps/uvwasi/src/clocks.c index b59cbd6bb1..8dc5d6557e 100644 --- a/deps/uvwasi/src/clocks.c +++ b/deps/uvwasi/src/clocks.c @@ -37,12 +37,12 @@ ); \ } \ \ - (time) = (((sys_system.wHour * 3600) + (sys_system.wMinute * 60) + \ - sys_system.wSecond) * NANOS_PER_SEC) + \ - (sys_system.wMilliseconds * 1000000) + \ - (((sys_user.wHour * 3600) + (sys_user.wMinute * 60) + \ - sys_user.wSecond) * NANOS_PER_SEC) + \ - (sys_user.wMilliseconds * 1000000); \ + (time) = (((uvwasi_timestamp_t)(sys_system.wHour * 3600) + \ + (sys_system.wMinute * 60) + sys_system.wSecond) * NANOS_PER_SEC) + \ + ((uvwasi_timestamp_t)(sys_system.wMilliseconds) * 1000000) + \ + (((uvwasi_timestamp_t)(sys_user.wHour * 3600) + \ + (sys_user.wMinute * 60) + sys_user.wSecond) * NANOS_PER_SEC) + \ + ((uvwasi_timestamp_t)(sys_user.wMilliseconds) * 1000000); \ return UVWASI_ESUCCESS; \ } while (0) @@ -52,7 +52,7 @@ struct timespec ts; \ if (0 != clock_gettime((clk), &ts)) \ return uvwasi__translate_uv_error(uv_translate_sys_error(errno)); \ - (time) = (ts.tv_sec * NANOS_PER_SEC) + ts.tv_nsec; \ + (time) = ((uvwasi_timestamp_t)(ts.tv_sec) * NANOS_PER_SEC) + ts.tv_nsec; \ return UVWASI_ESUCCESS; \ } while (0) @@ -62,9 +62,9 @@ struct rusage ru; \ if (0 != getrusage((who), &ru)) \ return uvwasi__translate_uv_error(uv_translate_sys_error(errno)); \ - (time) = (ru.ru_utime.tv_sec * NANOS_PER_SEC) + \ + (time) = ((uvwasi_timestamp_t)(ru.ru_utime.tv_sec) * NANOS_PER_SEC) + \ (ru.ru_utime.tv_usec * 1000) + \ - (ru.ru_stime.tv_sec * NANOS_PER_SEC) + \ + ((uvwasi_timestamp_t)(ru.ru_stime.tv_sec) * NANOS_PER_SEC) + \ (ru.ru_stime.tv_usec * 1000); \ return UVWASI_ESUCCESS; \ } while (0) @@ -83,9 +83,9 @@ &count)) { \ return UVWASI_ENOSYS; \ } \ - (time) = (info.user_time.seconds * NANOS_PER_SEC) + \ + (time) = ((uvwasi_timestamp_t)(info.user_time.seconds) * NANOS_PER_SEC) + \ (info.user_time.microseconds * 1000) + \ - (info.system_time.seconds * NANOS_PER_SEC) + \ + ((uvwasi_timestamp_t)(info.system_time.seconds) * NANOS_PER_SEC) + \ (info.system_time.microseconds * 1000); \ return UVWASI_ESUCCESS; \ } while (0) @@ -109,7 +109,7 @@ if (0 != clock_getres((clk), &ts)) \ (time) = 1000000; \ else \ - (time) = (ts.tv_sec * NANOS_PER_SEC) + ts.tv_nsec; \ + (time) = ((uvwasi_timestamp_t)(ts.tv_sec) * NANOS_PER_SEC) + ts.tv_nsec; \ return UVWASI_ESUCCESS; \ } while (0) diff --git a/deps/uvwasi/src/fd_table.c b/deps/uvwasi/src/fd_table.c index 877faf4ca1..7782f1ee43 100644 --- a/deps/uvwasi/src/fd_table.c +++ b/deps/uvwasi/src/fd_table.c @@ -172,7 +172,7 @@ exit: uvwasi_errno_t uvwasi_fd_table_init(uvwasi_t* uvwasi, - uvwasi_options_t* options) { + const uvwasi_options_t* options) { struct uvwasi_fd_table_t* table; uvwasi_errno_t err; int r; diff --git a/deps/uvwasi/src/fd_table.h b/deps/uvwasi/src/fd_table.h index 474a0231e0..0755c2d17f 100644 --- a/deps/uvwasi/src/fd_table.h +++ b/deps/uvwasi/src/fd_table.h @@ -29,7 +29,7 @@ struct uvwasi_fd_table_t { }; uvwasi_errno_t uvwasi_fd_table_init(struct uvwasi_s* uvwasi, - struct uvwasi_options_s* options); + const struct uvwasi_options_s* options); void uvwasi_fd_table_free(struct uvwasi_s* uvwasi, struct uvwasi_fd_table_t* table); uvwasi_errno_t uvwasi_fd_table_insert(struct uvwasi_s* uvwasi, diff --git a/deps/uvwasi/src/uvwasi.c b/deps/uvwasi/src/uvwasi.c index 0b4b091f9d..25ce4ab846 100644 --- a/deps/uvwasi/src/uvwasi.c +++ b/deps/uvwasi/src/uvwasi.c @@ -127,6 +127,9 @@ void* uvwasi__malloc(const uvwasi_t* uvwasi, size_t size) { } void uvwasi__free(const uvwasi_t* uvwasi, void* ptr) { + if (ptr == NULL) + return; + uvwasi->allocator->free(ptr, uvwasi->allocator->mem_user_data); } @@ -229,7 +232,7 @@ static uvwasi_errno_t uvwasi__setup_ciovs(const uvwasi_t* uvwasi, } -uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, uvwasi_options_t* options) { +uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, const uvwasi_options_t* options) { uv_fs_t realpath_req; uv_fs_t open_req; uvwasi_errno_t err; |