Skip to content

Commit a279f87

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 a279f87

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,15 @@ _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+
// See https://github.com/bytecodealliance/wasmtime/issues/3714
63+
if (clk > __WASI_CLOCKID_THREAD_CPUTIME_ID || clk < 0) {
64+
errno = EINVAL;
65+
return -1;
66+
}
6267
if (__wasi_syscall_ret(__wasi_clock_time_get(clk, 1, &timestamp))) {
6368
return -1;
6469
}
65-
*ts = __wasi_timestamp_to_timespec(timestamp);
70+
*ts = __wasi_timestamp_to_timespec(timestamp);
6671
return 0;
6772
}
6873
#else // __EMSCRIPTEN__

system/lib/standalone/standalone.c

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

4444
int clock_getres(clockid_t clk_id, struct timespec *tp) {
45+
// See https://github.com/bytecodealliance/wasmtime/issues/3714
46+
if (clk_id > __WASI_CLOCKID_THREAD_CPUTIME_ID || clk_id < 0) {
47+
errno = EINVAL;
48+
return -1;
49+
}
4550
__wasi_timestamp_t res;
4651
__wasi_errno_t error = __wasi_clock_res_get(clk_id, &res);
4752
if (error != __WASI_ERRNO_SUCCESS) {

0 commit comments

Comments
 (0)