Commit 85eed83
authored
Fix
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 a `u32` instead
of a `u8` to ensure that if there are 256 variants it actually compares
against 256 instead of 0 by accident.#[derive(Lift)] for enums of 256 cases (#12140)1 parent cdc7bfe commit 85eed83
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
631 | 631 | | |
632 | 632 | | |
633 | 633 | | |
634 | | - | |
| 634 | + | |
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
| |||
667 | 667 | | |
668 | 668 | | |
669 | 669 | | |
670 | | - | |
| 670 | + | |
671 | 671 | | |
672 | 672 | | |
673 | 673 | | |
| |||
0 commit comments