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

Avoid arithmetic overflow in the constructors of weekday #5156

Merged

Conversation

frederick-vs-ja
Copy link
Contributor

Fixes #5153.

@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner November 29, 2024 02:16
stl/inc/chrono Show resolved Hide resolved
@CaseyCarter CaseyCarter added the bug Something isn't working label Nov 30, 2024
stl/inc/chrono Show resolved Hide resolved
stl/inc/chrono Outdated Show resolved Hide resolved
Clarify some comments, and add a `static_assert` to catch if the code is ported somewhere for which `unsigned int` isn't 32 bits.
@CaseyCarter
Copy link
Member

I pushed a commit to wiggle some comments and add an _STL_INTERNAL_STATIC_ASSERT as documentation. Thanks!

@StephanTLavavej StephanTLavavej removed their assignment Dec 1, 2024
@StephanTLavavej StephanTLavavej self-assigned this Dec 3, 2024
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 83be0b7 into microsoft:main Dec 5, 2024
39 checks passed
@StephanTLavavej
Copy link
Member

Thanks for fixing this corner case! 🛠️ 🌋 😸

@frederick-vs-ja frederick-vs-ja deleted the unsigned-weekday-adjustment branch December 5, 2024 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working chrono C++20 chrono
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

<chrono>: integer overflow in weekday::weekday(sys_days::max())
4 participants