mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-15 07:20:05 +00:00
Fix a chrono formatting issue found by fuzzing
This commit is contained in:
parent
115ca96e0e
commit
8d50d814db
@ -1061,7 +1061,7 @@ void write_fractional_seconds(OutputIt& out, Duration d, int precision = -1) {
|
||||
leading_zeroes = std::min(leading_zeroes, precision);
|
||||
out = std::fill_n(out, leading_zeroes, '0');
|
||||
int remaining = precision - leading_zeroes;
|
||||
if (remaining < num_digits) {
|
||||
if (remaining != 0 && remaining < num_digits) {
|
||||
n /= to_unsigned(detail::pow10(to_unsigned(num_digits - remaining)));
|
||||
out = format_decimal<Char>(out, n, remaining).end;
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user