mirror of
https://github.com/fmtlib/fmt.git
synced 2026-06-15 00:16:15 +08:00
Fix buffer size in write_significand for GCC 16 LTO
Increase the stack buffer in the OutputIt overload from digits10<UInt>() + 2 to + 3 so write_fixed cannot write past the end when significand_size reaches digits10 + 1, silencing -Wstringop-overflow under GCC 16 with LTO (fixes #4767).
This commit is contained in:
parent
2f18a88e68
commit
040ee2028c
@ -2452,8 +2452,8 @@ template <typename OutputIt, typename UInt, typename Char,
|
||||
inline auto write_significand(OutputIt out, UInt significand,
|
||||
int significand_size, int integral_size,
|
||||
Char decimal_point) -> OutputIt {
|
||||
// Buffer is large enough to hold digits (digits10 + 1) and a decimal point.
|
||||
Char buffer[digits10<UInt>() + 2];
|
||||
// Buffer is large enough to hold digits (digits10 + 2) and a decimal point.
|
||||
Char buffer[digits10<UInt>() + 3];
|
||||
auto end = write_significand(buffer, significand, significand_size,
|
||||
integral_size, decimal_point);
|
||||
return detail::copy_noinline<Char>(buffer, end, out);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user