Skip to content

Commit b46184d

Browse files
cjihrigtargos
authored andcommitted
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: #40847 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 4c47b01 commit b46184d

File tree

6 files changed

+21
-18
lines changed

6 files changed

+21
-18
lines changed

deps/uvwasi/include/uvwasi.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ extern "C" {
1010

1111
#define UVWASI_VERSION_MAJOR 0
1212
#define UVWASI_VERSION_MINOR 0
13-
#define UVWASI_VERSION_PATCH 11
13+
#define UVWASI_VERSION_PATCH 12
1414
#define UVWASI_VERSION_HEX ((UVWASI_VERSION_MAJOR << 16) | \
1515
(UVWASI_VERSION_MINOR << 8) | \
1616
(UVWASI_VERSION_PATCH))
@@ -68,7 +68,7 @@ typedef struct uvwasi_options_s {
6868
} uvwasi_options_t;
6969

7070
/* Embedder API. */
71-
uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, uvwasi_options_t* options);
71+
uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, const uvwasi_options_t* options);
7272
void uvwasi_destroy(uvwasi_t* uvwasi);
7373
void uvwasi_options_init(uvwasi_options_t* options);
7474
/* Use int instead of uv_file to avoid needing uv.h */

deps/uvwasi/include/wasi_types.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <stddef.h>
55
#include <stdint.h>
66

7-
/* API: https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/docs.md */
7+
/* API: https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md */
88

99
typedef uint32_t uvwasi_size_t;
1010

deps/uvwasi/src/clocks.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
); \
3838
} \
3939
\
40-
(time) = (((sys_system.wHour * 3600) + (sys_system.wMinute * 60) + \
41-
sys_system.wSecond) * NANOS_PER_SEC) + \
42-
(sys_system.wMilliseconds * 1000000) + \
43-
(((sys_user.wHour * 3600) + (sys_user.wMinute * 60) + \
44-
sys_user.wSecond) * NANOS_PER_SEC) + \
45-
(sys_user.wMilliseconds * 1000000); \
40+
(time) = (((uvwasi_timestamp_t)(sys_system.wHour * 3600) + \
41+
(sys_system.wMinute * 60) + sys_system.wSecond) * NANOS_PER_SEC) + \
42+
((uvwasi_timestamp_t)(sys_system.wMilliseconds) * 1000000) + \
43+
(((uvwasi_timestamp_t)(sys_user.wHour * 3600) + \
44+
(sys_user.wMinute * 60) + sys_user.wSecond) * NANOS_PER_SEC) + \
45+
((uvwasi_timestamp_t)(sys_user.wMilliseconds) * 1000000); \
4646
return UVWASI_ESUCCESS; \
4747
} while (0)
4848

@@ -52,7 +52,7 @@
5252
struct timespec ts; \
5353
if (0 != clock_gettime((clk), &ts)) \
5454
return uvwasi__translate_uv_error(uv_translate_sys_error(errno)); \
55-
(time) = (ts.tv_sec * NANOS_PER_SEC) + ts.tv_nsec; \
55+
(time) = ((uvwasi_timestamp_t)(ts.tv_sec) * NANOS_PER_SEC) + ts.tv_nsec; \
5656
return UVWASI_ESUCCESS; \
5757
} while (0)
5858

@@ -62,9 +62,9 @@
6262
struct rusage ru; \
6363
if (0 != getrusage((who), &ru)) \
6464
return uvwasi__translate_uv_error(uv_translate_sys_error(errno)); \
65-
(time) = (ru.ru_utime.tv_sec * NANOS_PER_SEC) + \
65+
(time) = ((uvwasi_timestamp_t)(ru.ru_utime.tv_sec) * NANOS_PER_SEC) + \
6666
(ru.ru_utime.tv_usec * 1000) + \
67-
(ru.ru_stime.tv_sec * NANOS_PER_SEC) + \
67+
((uvwasi_timestamp_t)(ru.ru_stime.tv_sec) * NANOS_PER_SEC) + \
6868
(ru.ru_stime.tv_usec * 1000); \
6969
return UVWASI_ESUCCESS; \
7070
} while (0)
@@ -83,9 +83,9 @@
8383
&count)) { \
8484
return UVWASI_ENOSYS; \
8585
} \
86-
(time) = (info.user_time.seconds * NANOS_PER_SEC) + \
86+
(time) = ((uvwasi_timestamp_t)(info.user_time.seconds) * NANOS_PER_SEC) + \
8787
(info.user_time.microseconds * 1000) + \
88-
(info.system_time.seconds * NANOS_PER_SEC) + \
88+
((uvwasi_timestamp_t)(info.system_time.seconds) * NANOS_PER_SEC) + \
8989
(info.system_time.microseconds * 1000); \
9090
return UVWASI_ESUCCESS; \
9191
} while (0)
@@ -109,7 +109,7 @@
109109
if (0 != clock_getres((clk), &ts)) \
110110
(time) = 1000000; \
111111
else \
112-
(time) = (ts.tv_sec * NANOS_PER_SEC) + ts.tv_nsec; \
112+
(time) = ((uvwasi_timestamp_t)(ts.tv_sec) * NANOS_PER_SEC) + ts.tv_nsec; \
113113
return UVWASI_ESUCCESS; \
114114
} while (0)
115115

deps/uvwasi/src/fd_table.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ uvwasi_errno_t uvwasi_fd_table_insert(uvwasi_t* uvwasi,
172172

173173

174174
uvwasi_errno_t uvwasi_fd_table_init(uvwasi_t* uvwasi,
175-
uvwasi_options_t* options) {
175+
const uvwasi_options_t* options) {
176176
struct uvwasi_fd_table_t* table;
177177
uvwasi_errno_t err;
178178
int r;

deps/uvwasi/src/fd_table.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct uvwasi_fd_table_t {
2929
};
3030

3131
uvwasi_errno_t uvwasi_fd_table_init(struct uvwasi_s* uvwasi,
32-
struct uvwasi_options_s* options);
32+
const struct uvwasi_options_s* options);
3333
void uvwasi_fd_table_free(struct uvwasi_s* uvwasi,
3434
struct uvwasi_fd_table_t* table);
3535
uvwasi_errno_t uvwasi_fd_table_insert(struct uvwasi_s* uvwasi,

deps/uvwasi/src/uvwasi.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ void* uvwasi__malloc(const uvwasi_t* uvwasi, size_t size) {
127127
}
128128

129129
void uvwasi__free(const uvwasi_t* uvwasi, void* ptr) {
130+
if (ptr == NULL)
131+
return;
132+
130133
uvwasi->allocator->free(ptr, uvwasi->allocator->mem_user_data);
131134
}
132135

@@ -229,7 +232,7 @@ static uvwasi_errno_t uvwasi__setup_ciovs(const uvwasi_t* uvwasi,
229232
}
230233

231234

232-
uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, uvwasi_options_t* options) {
235+
uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, const uvwasi_options_t* options) {
233236
uv_fs_t realpath_req;
234237
uv_fs_t open_req;
235238
uvwasi_errno_t err;

0 commit comments

Comments
 (0)