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

Rust to_int() and related method do not check for overflow #4

Closed
DaGenix opened this issue Oct 16, 2013 · 3 comments
Closed

Rust to_int() and related method do not check for overflow #4

DaGenix opened this issue Oct 16, 2013 · 3 comments
Assignees

Comments

@DaGenix
Copy link
Owner

DaGenix commented Oct 16, 2013

The rust to_int() and related methods on integers do not check for overflow in the current Rust codebase. Either update the library to work around this, or create a patch against Rust to do these checks.

@ghost ghost assigned DaGenix Oct 16, 2013
@l0kod
Copy link

l0kod commented Sep 6, 2014

Like for add_bytes_to_bits, std:num:Checked{Add,Sub,Mul,Div} could help.

cc rust-lang/rust#8635
cc rust-lang/rust#16446

@thestinger
Copy link

This seems to work fine:

> 255u.to_u8()
None

@DaGenix
Copy link
Owner Author

DaGenix commented Sep 18, 2014

I believe that when I opened this issue last October that those functions didn't check for overlfow. Or, maybe they did and I misread them. Regardless, they certainly do now. I'll close this issue since this doesn't seem to be a problem.

Thanks @thestinger and @l0kod!

@DaGenix DaGenix closed this as completed Sep 18, 2014
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

No branches or pull requests

3 participants