Chromium Code Reviews| Index: net/cookies/cookie_util.cc |
| diff --git a/net/cookies/cookie_util.cc b/net/cookies/cookie_util.cc |
| index 210b8d479af7bcafc3274746b321a0fc6915d26c..9513dc83a6f2d2f507a29c2ee66961aa393e1fb1 100644 |
| --- a/net/cookies/cookie_util.cc |
| +++ b/net/cookies/cookie_util.cc |
| @@ -200,12 +200,14 @@ base::Time ParseCookieTime(const std::string& time_string) { |
| if (exploded.year >= 0 && exploded.year <= 68) |
| exploded.year += 2000; |
| - // If our values are within their correct ranges, we got our time. |
| if (exploded.day_of_month >= 1 && exploded.day_of_month <= 31 && |
|
eroman
2016/10/20 18:05:21
Can you remove this "if" statement?
FromUTCExplod
|
| - exploded.month >= 1 && exploded.month <= 12 && |
| - exploded.year >= 1601 && exploded.year <= 30827 && |
| - exploded.hour <= 23 && exploded.minute <= 59 && exploded.second <= 59) { |
| - return base::Time::FromUTCExploded(exploded); |
| + exploded.month >= 1 && exploded.month <= 12 && exploded.year >= 1601 && |
| + exploded.year <= 30827 && exploded.hour <= 23 && exploded.minute <= 59 && |
| + exploded.second <= 59) { |
| + // Time conversion can fail. See comments in base/time.h |
| + base::Time out_time; |
| + if (base::Time::FromUTCExploded(exploded, &out_time)) |
| + return out_time; |
| } |
| // One of our values was out of expected range. For well-formed input, |