Skip to content

Invalid clock ID leads to fatal error #3714

@kripken

Description

@kripken

This happens when sending an invalid clock id to wasi_snapshot_preview1::clock_time_get or clock_res_get. In emscripten we have a test that sends 42, if the specific value matters, which is how we noticed this. (The test is checking for error handling.)

History:

  • In wasmtime 0.8.0 an error is returned.
  • In 0.18.0 a warning is printed out. (This extra logging makes the emscripten test fail, which is how we noticed this.)
  • In 0.33.0 the VM hits a fatal error:
Caused by:
    0: failed to invoke command default
    1: In func wasi_snapshot_preview1::clock_time_get at convert Clockid: Invalid enum value Clockid
       wasm backtrace:
           0:  0x917 - <unknown>!__clock_gettime
           1:  0x6cb - <unknown>!__original_main
           2:  0x8e5 - <unknown>!_start

I would assume that an invalid clock id should lead to an error and not extra logging or a fatal VM error, but reading the docs I can't actually find an answer to that... Apologies if this is not a bug!

Emscripten issue where this was noticed: emscripten-core/emscripten#16076

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions