Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper overflow handling #2734

Merged
merged 7 commits into from
Mar 25, 2022
Merged

Proper overflow handling #2734

merged 7 commits into from
Mar 25, 2022

Conversation

Ghabry
Copy link
Member

@Ghabry Ghabry commented Feb 24, 2022

When variables overflow the value is now correctly clamped.

Mostly required by Maniac Patch because it uses the entire integer range but also broke with multiply in normal maker (see fixed issue).

Also implemented the "Input numbers via numpad" extension from newer Maniac versions.

Fix #2650

@Ghabry
Copy link
Member Author

Ghabry commented Feb 26, 2022

Undefined behaviour at its finest and only in release:
abs(INT_MIN) is again INT_MIN because it overflows and max(abs(INT_MAX), abs(INT_MIN)) returns a max value of INT_MIN... wtf?! :)

Changed to long long to ensure it fits ^^

@fdelapena fdelapena self-requested a review February 28, 2022 22:45
@fdelapena fdelapena added the Awaiting Rebase Pull requests with conflicting files due to former merge label Mar 24, 2022
@Ghabry Ghabry removed the Awaiting Rebase Pull requests with conflicting files due to former merge label Mar 24, 2022
@fdelapena fdelapena merged commit 5749e48 into EasyRPG:master Mar 25, 2022
@Ghabry Ghabry deleted the maniac/numbers branch May 29, 2022 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Incorrect handling of overflow
2 participants