Chromium Code Reviews| Index: net/base/sdch_manager.cc |
| diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc |
| index 7f8245cc917e3507cef3b9bae14fad32233aa06f..699c8c5469f27e785521f67d99eec5a3be0cb6cb 100644 |
| --- a/net/base/sdch_manager.cc |
| +++ b/net/base/sdch_manager.cc |
| @@ -376,10 +376,15 @@ SdchProblemCode SdchManager::AddSdchDictionary( |
| if (value != "1.0") |
| return SDCH_DICTIONARY_UNSUPPORTED_VERSION; |
| } else if (name == "max-age") { |
| - int64_t seconds; |
| - // TODO(eroman): crbug.com/596541 -- should not accept a leading +. |
| - base::StringToInt64(value, &seconds); |
| - expiration = base::Time::Now() + base::TimeDelta::FromSeconds(seconds); |
| + // max-age must be a non-negative number. If it is very large saturate |
|
eroman
2016/04/11 19:36:37
Randy, what is the expected behavior here?
I wrot
|
| + // to 2^32 - 1. |
| + uint32_t seconds = std::numeric_limits<uint32_t>::max(); |
| + ParseIntError parse_int_error; |
| + if (ParseUint32(value, &seconds, &parse_int_error) || |
| + parse_int_error == ParseIntError::FAILED_OVERFLOW) { |
| + expiration = |
| + base::Time::Now() + base::TimeDelta::FromSeconds(seconds); |
| + } |
| } else if (name == "port") { |
| int port; |
| if (ParseInt32(value, ParseIntFormat::NON_NEGATIVE, &port)) |