Index: net/ftp/ftp_directory_listing_parser_windows.cc |
=================================================================== |
--- net/ftp/ftp_directory_listing_parser_windows.cc (revision 53666) |
+++ net/ftp/ftp_directory_listing_parser_windows.cc (working copy) |
@@ -48,11 +48,18 @@ |
return false; |
if (!StringToInt(time_parts[1], &time_exploded.minute)) |
return false; |
+ if (!time_exploded.HasValidValues()) |
+ return false; |
string16 am_or_pm(columns[1].substr(5, 2)); |
- if (EqualsASCII(am_or_pm, "PM")) |
- time_exploded.hour += 12; |
- else if (!EqualsASCII(am_or_pm, "AM")) |
+ if (EqualsASCII(am_or_pm, "PM")) { |
+ if (time_exploded.hour < 12) |
+ time_exploded.hour += 12; |
+ } else if (EqualsASCII(am_or_pm, "AM")) { |
+ if (time_exploded.hour == 12) |
+ time_exploded.hour = 0; |
+ } else { |
return false; |
+ } |
// We don't know the time zone of the server, so just use local time. |
*time = base::Time::FromLocalExploded(time_exploded); |