Skip to content

Return an optional instead of casting -1 into an enum#3539

Open
staticssleever668 wants to merge 1 commit intoEasyRPG:masterfrom
staticssleever668:fix_enum_cast_ub
Open

Return an optional instead of casting -1 into an enum#3539
staticssleever668 wants to merge 1 commit intoEasyRPG:masterfrom
staticssleever668:fix_enum_cast_ub

Conversation

@staticssleever668
Copy link
Copy Markdown

For enums without a fixed underlying type, casting into them from numbers outside of their enumeration values is undefined behavior. Fixes running tests with UBSan: runtime error: load of value 4294967295, which is not a valid value for type 'Trigger'.

For enums without a fixed underlying type, casting into them from
numbers outside of their enumeration values is undefined behavior.
Fixes running tests with UBSan: `runtime error: load of value
4294967295, which is not a valid value for type 'Trigger'`.
@github-actions github-actions Bot added the Tests label Apr 24, 2026
@Ghabry Ghabry added this to the 0.8.2 milestone Apr 25, 2026
@Ghabry
Copy link
Copy Markdown
Member

Ghabry commented Apr 25, 2026

Jenkins: test this please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants