Skip to content

Commit 5df7a57

Browse files
committed
Update version of wasmtime used in CI
Includes added couple of extra checks when calling `__wasi_clock` functions. These only apply to standlone builds as the non-standalone builds implement these functions directly in JS. See #16076
1 parent 33c40be commit 5df7a57

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ jobs:
331331
name: get wasmtime
332332
command: |
333333
# use a pinned version due to https://github.com/bytecodealliance/wasmtime/issues/714
334-
export VERSION=v0.8.0
335-
wget https://github.com/bytecodealliance/wasmtime/releases/download/v0.8.0/wasmtime-$VERSION-x86_64-linux.tar.xz
334+
export VERSION=v0.33.0
335+
wget https://github.com/bytecodealliance/wasmtime/releases/download/$VERSION/wasmtime-$VERSION-x86_64-linux.tar.xz
336336
tar -xf wasmtime-$VERSION-x86_64-linux.tar.xz
337337
cp wasmtime-$VERSION-x86_64-linux/wasmtime ~/vms
338338
- run:

system/lib/libc/musl/src/time/clock_gettime.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ _Static_assert(CLOCK_MONOTONIC == __WASI_CLOCKID_MONOTONIC, "monotonic clock mus
5959

6060
int __clock_gettime(clockid_t clk, struct timespec *ts) {
6161
__wasi_timestamp_t timestamp;
62+
if (clk > __WASI_CLOCKID_THREAD_CPUTIME_ID || clk < 0) {
63+
errno = EINVAL;
64+
return -1;
65+
}
6266
if (__wasi_syscall_ret(__wasi_clock_time_get(clk, 1, &timestamp))) {
6367
return -1;
6468
}
65-
*ts = __wasi_timestamp_to_timespec(timestamp);
69+
*ts = __wasi_timestamp_to_timespec(timestamp);
6670
return 0;
6771
}
6872
#else // __EMSCRIPTEN__

system/lib/standalone/standalone.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ struct timespec __wasi_timestamp_to_timespec(__wasi_timestamp_t timestamp) {
4242
}
4343

4444
int clock_getres(clockid_t clk_id, struct timespec *tp) {
45+
if (clk_id > __WASI_CLOCKID_THREAD_CPUTIME_ID || clk_id < 0) {
46+
errno = EINVAL;
47+
return -1;
48+
}
4549
__wasi_timestamp_t res;
4650
__wasi_errno_t error = __wasi_clock_res_get(clk_id, &res);
4751
if (error != __WASI_ERRNO_SUCCESS) {

0 commit comments

Comments
 (0)