-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
Description
This is a follow-up of #924. The same crash can happen even with format, as it will result in a call to put_time(which will make call to functions like _Strftime):
#include<format>
#include<iostream>
#include<chrono>
int main() {
using namespace std::chrono;
try {
sys_time<seconds> t{seconds(335303598060)};
std::cout << std::format("{:%c}", t);
}
catch (std::exception& e) {
std::cout << e.what();// unreacheable.
}
return 0;
}Line 5470 in c8d1efb
| _Stream << _STD put_time<_CharT>(&_Time, _Fmt_string(_Spec, _Fmt_str)); |
Instead of an exception, the program will give a crashing error:
Unhandled exception at 0x00007FF80ACA1208 (ucrtbase.dll) in test.exe:
An invalid parameter was passed to a function that considers invalid parameters fatal.
Please consider doing some investigations for strftime series. The crash-on-failed-check behavior interacts really poorly with C++.