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

cast to larger type before doing arithmetic to avoid signed integer o… #360

Merged
merged 1 commit into from
Sep 29, 2024

Conversation

ZXShady
Copy link
Contributor

@ZXShady ZXShady commented Sep 28, 2024

…verflow

https://godbolt.org/z/soTad4zEq

this godbolt links shows that it is UB to multiply then cast if the amount is large enough

@ZXShady ZXShady force-pushed the avoid_signed_overflow_ub branch from 446ff82 to 8239d45 Compare September 28, 2024 22:14
src/CSFML/System/Time.cpp Outdated Show resolved Hide resolved
@ZXShady ZXShady force-pushed the avoid_signed_overflow_ub branch from 8239d45 to 03168dd Compare September 29, 2024 00:51
…verflow

https://godbolt.org/z/soTad4zEq

this godbolt links shows that it is UB to multiply then cast if the amount is large enough
@ChrisThrasher ChrisThrasher force-pushed the avoid_signed_overflow_ub branch from 03168dd to 182edce Compare September 29, 2024 01:13
@ChrisThrasher ChrisThrasher merged commit b626f65 into SFML:master Sep 29, 2024
39 checks passed
@eXpl0it3r eXpl0it3r added this to the 3.0 milestone Sep 29, 2024
@ZXShady ZXShady deleted the avoid_signed_overflow_ub branch October 2, 2024 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants