Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Unified Diff: net/cookies/cookie_util.h

Issue 2424443002: When parsing cookie expiration times, saturate out of range dates (Closed)
Patch Set: Response to comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cookies/cookie_monster_store_test.cc ('k') | net/cookies/cookie_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cookies/cookie_util.h
diff --git a/net/cookies/cookie_util.h b/net/cookies/cookie_util.h
index 0bf1452af864015331c1491ad50f78d1652e81dc..343ca503596b860311f4e0594beef71a8162e999 100644
--- a/net/cookies/cookie_util.h
+++ b/net/cookies/cookie_util.h
@@ -37,8 +37,19 @@ NET_EXPORT bool GetCookieDomainWithString(const GURL& url,
// i.e. it doesn't begin with a leading '.' character.
NET_EXPORT bool DomainIsHostOnly(const std::string& domain_string);
-// Parses the string with the cookie time (very forgivingly).
-NET_EXPORT base::Time ParseCookieTime(const std::string& time_string);
+// Parses the string with the cookie expiration time (very forgivingly).
+// Returns the "null" time on failure.
+//
+// If the expiration date is either too small or too large (there are
+// platform-specific limits for allowed date ranges), then it will be clipped
+// to the min/max time Time::FromUTCExploded() can return on the current
+// platform,
+// rather than failing. In particular:
+//
+// On non-Mac 32-bit POSIX, times will currently be clamped between 1970 and
+// 2038.
+// On Windows, times will currently be clamped between year 1601 and 30827.
+NET_EXPORT base::Time ParseCookieExpirationTime(const std::string& time_string);
// Convenience for converting a cookie origin (domain and https pair) to a URL.
NET_EXPORT GURL CookieOriginToURL(const std::string& domain, bool is_https);
« no previous file with comments | « net/cookies/cookie_monster_store_test.cc ('k') | net/cookies/cookie_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698