summaryrefslogtreecommitdiffstats
path: root/net/http
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-22 20:30:02 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-22 20:30:02 +0000
commit681a0d5d3283e0dbbffe91cff146937fed4e8115 (patch)
tree02369bd17f66b63897f2d062efcb97731cfd1124 /net/http
parent5fd6433b7344795fd75e53cd1aa946b3ebcccfc9 (diff)
downloadchromium_src-681a0d5d3283e0dbbffe91cff146937fed4e8115.zip
chromium_src-681a0d5d3283e0dbbffe91cff146937fed4e8115.tar.gz
chromium_src-681a0d5d3283e0dbbffe91cff146937fed4e8115.tar.bz2
InitFromPickle should return false on any deserialization
error. Require socket_address when deserializing version 2 or later. R=rsleevi@chromium.org,rvargas@chromium.org BUG=none TEST=none Review URL: http://codereview.chromium.org/6880130 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82700 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r--net/http/http_response_info.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/net/http/http_response_info.cc b/net/http/http_response_info.cc
index 5aee4b1..ed7a902 100644
--- a/net/http/http_response_info.cc
+++ b/net/http/http_response_info.cc
@@ -133,7 +133,8 @@ bool HttpResponseInfo::InitFromPickle(const Pickle& pickle,
// read response-headers
headers = new HttpResponseHeaders(pickle, &iter);
- DCHECK_NE(headers->response_code(), -1);
+ if (headers->response_code() == -1)
+ return false;
// read ssl-info
if (flags & RESPONSE_INFO_HAS_CERT) {
@@ -141,6 +142,8 @@ bool HttpResponseInfo::InitFromPickle(const Pickle& pickle,
X509Certificate::PICKLETYPE_SINGLE_CERTIFICATE :
X509Certificate::PICKLETYPE_CERTIFICATE_CHAIN;
ssl_info.cert = X509Certificate::CreateFromPickle(pickle, &iter, type);
+ if (!ssl_info.cert)
+ return false;
}
if (flags & RESPONSE_INFO_HAS_CERT_STATUS) {
int cert_status;
@@ -161,9 +164,7 @@ bool HttpResponseInfo::InitFromPickle(const Pickle& pickle,
return false;
}
- // Read socket_address. This was not always present in the response info,
- // so we don't fail if it can't be read. If additional fields are added in
- // a future version, then they must only be read if this operation succeeds.
+ // Read socket_address.
std::string socket_address_host;
if (pickle.ReadString(&iter, &socket_address_host)) {
// If the host was written, we always expect the port to follow.
@@ -171,6 +172,10 @@ bool HttpResponseInfo::InitFromPickle(const Pickle& pickle,
if (!pickle.ReadUInt16(&iter, &socket_address_port))
return false;
socket_address = HostPortPair(socket_address_host, socket_address_port);
+ } else if (version > 1) {
+ // socket_address was not always present in version 1 of the response
+ // info, so we don't fail if it can't be read.
+ return false;
}
was_fetched_via_spdy = (flags & RESPONSE_INFO_WAS_SPDY) != 0;