Skip to content

Fix off-by-one error in enum discriminant validation#12356

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
zzjas:issue-12354
Jan 15, 2026
Merged

Fix off-by-one error in enum discriminant validation#12356
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
zzjas:issue-12354

Conversation

@zzjas
Copy link
Copy Markdown
Contributor

@zzjas zzjas commented Jan 15, 2026

The discriminant check used i32.gt_u when it should use i32.ge_u. For an enum with N cases (valid discriminants 0 to N-1), a discriminant of exactly N was incorrectly accepted.

Closes #12354

The discriminant check used `i32.gt_u` when it should use `i32.ge_u`.
For an enum with N cases (valid discriminants 0 to N-1), a discriminant
of exactly N was incorrectly accepted.

Closes bytecodealliance#12354
@zzjas zzjas requested a review from a team as a code owner January 15, 2026 02:54
@zzjas zzjas requested review from dicej and removed request for a team January 15, 2026 02:54
Copy link
Copy Markdown
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, and thanks for the test too!

@alexcrichton alexcrichton added this pull request to the merge queue Jan 15, 2026
Merged via the queue into bytecodealliance:main with commit dde8960 Jan 15, 2026
45 checks passed
@zzjas zzjas deleted the issue-12354 branch January 30, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Off-by-One Enum discriminant validation in component adapter

2 participants