alexcrichton opened PR #12140 from alexcrichton:fix-fuzz to bytecodealliance:main:
This commit fixes a longstanding bug in the implementation of
#[derive(Lift)]which was found by the component_api fuzzer recently. Specifically when an enum or variant had exactly 256 cases the comparison of the discriminant for being out-of-bounds was done in the n-bit space of the discriminant rather than a bit-space that can hold the entire discriminant. The fix here is to compare with au32instead of au8to ensure that if there are 256 variants it actually compares against 256 instead of 0 by accident.<!--
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
-->
alexcrichton requested pchickey for a review on PR #12140.
alexcrichton requested wasmtime-core-reviewers for a review on PR #12140.
alexcrichton commented on PR #12140:
I'll note test-wise I opted against adding a test here because it'd be a very large test with 256 wit cases, 256 wat cases, 256 rust cases, etc, so I figured we could lean on the fuzzers here instead.
pchickey submitted PR review.
alexcrichton merged PR #12140.
Last updated: Dec 13 2025 at 19:03 UTC