Open grievejia opened 7 years ago
Thanks for reporting.
d = 7-0-2
It's parsed as Time type. I think this is not a valid Time value, so this should be rejected in the parser, maybe :cry:
I've added a workaround, but this is not a complete fix, I believe.
Unfortunately, it is not :( It neither rejects nonsensical date like "2000-2-30", nor accepts valid date like "1800-1-1". I admit that parsing datetime format in a RFC3339-conforming way is quite hard, though...
I know that does not reject nonsense date. Also, since we're using std::chrono::time_point to represent a time, date before unix epoch is not considered well. Supporting older date will cause a conversion problem between Gregorian calendar and Julian calendar, which I really don't want to touch.
Here's the input that will trigger the issue: int_overflow.txt Feed it into master(c2444ed) parse_stdin built with UndefinedBehaviorSanitizer and linked with libstdc++(shipped with gcc 7.1.1) will crash the parser:
Interestingly, the issue would disappear if I choose to use libc++ instead.