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

I256 Checked Multiply Overflows for i256::MIN #3941

Closed
tustvold opened this issue Mar 25, 2023 · 0 comments · Fixed by #3943
Closed

I256 Checked Multiply Overflows for i256::MIN #3941

tustvold opened this issue Mar 25, 2023 · 0 comments · Fixed by #3943
Assignees
Labels
arrow Changes to the arrow crate bug

Comments

@tustvold
Copy link
Contributor

Describe the bug

The i256::checked_mul works by computing the absolute values, unfortunately this runs into an issue with i256::MIN as the absolute value overflows i256

To Reproduce

i256::MIN.checked_mul(i256::ONE).unwrap()

Expected behavior

The above should not panic

Additional context

@tustvold tustvold added the bug label Mar 25, 2023
@tustvold tustvold self-assigned this Mar 25, 2023
tustvold added a commit to tustvold/arrow-rs that referenced this issue Mar 25, 2023
tustvold added a commit to tustvold/arrow-rs that referenced this issue Mar 25, 2023
tustvold added a commit that referenced this issue Mar 26, 2023
* Fix checked i256 arithmetic (#3942) (#3941)

* Tweak

* Add is_positive

* Make const
@tustvold tustvold added the arrow Changes to the arrow crate label Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant