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

Au::from_px can overflow. #22

Closed
emilio opened this issue Oct 2, 2016 · 1 comment · Fixed by #26
Closed

Au::from_px can overflow. #22

emilio opened this issue Oct 2, 2016 · 1 comment · Fixed by #26

Comments

@emilio
Copy link
Member

emilio commented Oct 2, 2016

While trying to run debug assertions in our automation (servo/servo#13387 (review)), I discovered an integer overflow in an image dimension setter, caused by Au::from_px.

Should we check for overflow in that function and return None in that case? Or should we just use unchecked arithmetic in debug builds?

cc @pcwalton @mbrubeck

@emilio
Copy link
Member Author

emilio commented Oct 2, 2016

Alternatively, of course, we can keep the checks and add an Au::from_px_unchecked for sites where we know this can happen, but there's not too much we can do about it, and Au::from_px_checked for sites where we explicitly want to handle that.

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 a pull request may close this issue.

1 participant