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>
This commit is contained in:
Colin Ihrig
2021-11-20 15:07:13 -05:00
committed by GitHub
parent a37b9c80ef
commit e10085a03b
6 changed files with 21 additions and 18 deletions

View File

@@ -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 */

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;

View File

@@ -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,

View File

@@ -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;