zzjas opened PR #12356 from zzjas:issue-12354 to bytecodealliance:main:
The discriminant check used
i32.gt_uwhen it should usei32.ge_u. For an enum with N cases (valid discriminants 0 to N-1), a discriminant of exactly N was incorrectly accepted.Closes #12354
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
zzjas requested wasmtime-core-reviewers for a review on PR #12356.
zzjas requested dicej for a review on PR #12356.
alexcrichton submitted PR review:
Thanks for this, and thanks for the test too!
alexcrichton added PR #12356 Fix off-by-one error in enum discriminant validation to the merge queue.
alexcrichton merged PR #12356.
alexcrichton removed PR #12356 Fix off-by-one error in enum discriminant validation from the merge queue.
Last updated: Jan 29 2026 at 13:25 UTC