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

trigger assertion in to_unsigned #1135

Merged
merged 2 commits into from
May 1, 2019
Merged

Conversation

pauldreik
Copy link
Contributor

The following assertion was triggered by fuzzing with chrono duration:

constexpr typename std::make_unsigned<_Tp>::type fmt::v5::internal::to_unsigned(Int) [with Int = long int; typename std::make_unsigned<_Tp>::type = long unsigned int]: Assertion `(value >= 0) && "negative value"' failed.

This pull request adds a unit test that triggers the same assertion.

I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.

fmt/include/fmt/core.h:246:
typename std::make_unsigned<_Tp>::type fmt::v5::internal::to_unsigned(Int)
[with Int = long int;
 typename std::make_unsigned<_Tp>::type = long unsigned int]:
Assertion `(value >= 0) && "negative value"' failed.
@pauldreik
Copy link
Contributor Author

The unit test fails on CI, as intended.

@vitaut vitaut merged commit b3cc9c0 into fmtlib:master May 1, 2019
@pauldreik pauldreik deleted the invalidcolons branch May 1, 2019 19:44
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 this pull request may close these issues.

2 participants