On msys2 the following throws a std::bad_alloc exception (example, msys2 ci output):
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?
On msys2 the following throws a
std::bad_allocexception (example, msys2 ci output):The cause is that
%Fand%Tare not supported by the underlyingstrftimeimplementation 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?