You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
auto t1 = std::chrono::system_clock::now();
fmt::format("{:%F %T}", t1)
The cause is that %F and %T are not supported by the underlying strftime implementation and it just returns an empty string, which fmt interprets as the buffer being too small, so it allocates more memory and repeats until the system runs out of memory. (looks like the same issue as #367)
Previously fmt had a heuristic to avoid this (a5d0adf),
which was replaced with a nice solution that (tried to) guarantee a non-empty result from strftime (#2244), but apparently an empty result is still possible.
Maybe an upper bound on the memory allocated could be added, or the heuristic could be re-instated?
The text was updated successfully, but these errors were encountered:
This is clearly a bug in the strftime implementation, please report to the relevant project (msys?). I don't think we should reintroduce the heuristic but we could parse the format string ourselves and reject problematic specifiers as a workaround. A PR would be welcome.
On msys2 the following throws a
std::bad_alloc
exception (example, msys2 ci output):The cause is that
%F
and%T
are not supported by the underlyingstrftime
implementation and it just returns an empty string, which fmt interprets as the buffer being too small, so it allocates more memory and repeats until the system runs out of memory. (looks like the same issue as #367)Previously fmt had a heuristic to avoid this (a5d0adf),
which was replaced with a nice solution that (tried to) guarantee a non-empty result from
strftime
(#2244), but apparently an empty result is still possible.Maybe an upper bound on the memory allocated could be added, or the heuristic could be re-instated?
The text was updated successfully, but these errors were encountered: