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

unsigned integer overflow in format-inl.h #1515

Closed
federico-busato opened this issue Jan 13, 2020 · 1 comment
Closed

unsigned integer overflow in format-inl.h #1515

federico-busato opened this issue Jan 13, 2020 · 1 comment

Comments

@federico-busato
Copy link
Contributor

example:
fmt::print("{}, {}\n", 2172.112284689786, 0.18808973381374017);

fmt/format-inl.h:417:51: runtime error: unsigned integer overflow: 11 - 52 cannot be represented in type 'unsigned long'
fmt/format-inl.h:484:53: runtime error: unsigned integer overflow: 18446744073709551607 * 1292913986 cannot be represented in type 'unsigned long'
fmt/format-inl.h:417:35: runtime error: unsigned integer overflow: 1020 - 1023 cannot be represented in type 'unsigned long'

found with -fsanitize=undefined -fsanitize=unsigned-integer-overflow (clang 9)

I'm not sure if it is intentional or not. Reproducible on fmt-6.1.2
It can be also suppressed with __attribute__((no_sanitize("unsigned-integer-overflow")))

@vitaut
Copy link
Contributor

vitaut commented Jan 18, 2020

Those overflows are benign but unnecessary. Should be gone as of 75765bf. Thanks for reporting.

@vitaut vitaut closed this as completed Jan 18, 2020
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

2 participants