From 096bad2622e009fd4a5bc87890a9139ab6df6825 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Thu, 13 Apr 2017 12:45:28 -0400 Subject: [PATCH] Parse should fail if fmt string is not consumed. --- date.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/date.h b/date.h index 54b9668..2f6a4ea 100644 --- a/date.h +++ b/date.h @@ -6177,6 +6177,8 @@ from_stream(std::basic_istream& is, const CharT* fmt, else read(is, CharT{'%'}, width, modified); } + if (is.rdstate() != ios::goodbit && *fmt != CharT{} && !is.fail()) + is.setstate(ios::failbit); if (!is.fail()) { if (y != not_a_2digit_year)