diff options
author | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-16 23:37:15 +0000 |
---|---|---|
committer | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-16 23:37:15 +0000 |
commit | 43549a8f2bb09da994c640f07962188bdecd78c3 (patch) | |
tree | 224798c1586cf561500f59c849725b5651442bdd /net/spdy | |
parent | 378b387cef8060d5534b5e7a520b88b8cd10ac2d (diff) | |
download | chromium_src-43549a8f2bb09da994c640f07962188bdecd78c3.zip chromium_src-43549a8f2bb09da994c640f07962188bdecd78c3.tar.gz chromium_src-43549a8f2bb09da994c640f07962188bdecd78c3.tar.bz2 |
Fix crash bug with SpdyProxyClientSocket where IsConnectedAndIdle
called on a closed socket would result in a null pointer dereference.
BUG=none
TEST=SpdyProxyClientSocketTest.ReadOnClosedSocketReturnsZero
Review URL: http://codereview.chromium.org/7029016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85554 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy')
-rw-r--r-- | net/spdy/spdy_proxy_client_socket.cc | 5 | ||||
-rw-r--r-- | net/spdy/spdy_proxy_client_socket_unittest.cc | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc index 199df0e..1e6e23a 100644 --- a/net/spdy/spdy_proxy_client_socket.cc +++ b/net/spdy/spdy_proxy_client_socket.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -114,7 +114,8 @@ bool SpdyProxyClientSocket::IsConnected() const { } bool SpdyProxyClientSocket::IsConnectedAndIdle() const { - return IsConnected() && !spdy_stream_->is_idle(); + return IsConnected() && spdy_stream_.get() != NULL && + !spdy_stream_->is_idle(); } const BoundNetLog& SpdyProxyClientSocket::NetLog() const { diff --git a/net/spdy/spdy_proxy_client_socket_unittest.cc b/net/spdy/spdy_proxy_client_socket_unittest.cc index 5b540a9..2e5ffba 100644 --- a/net/spdy/spdy_proxy_client_socket_unittest.cc +++ b/net/spdy/spdy_proxy_client_socket_unittest.cc @@ -957,6 +957,7 @@ TEST_F(SpdyProxyClientSocketTest, ReadOnClosedSocketReturnsZero) { ASSERT_EQ(0, sock_->Read(NULL, 1, NULL)); ASSERT_EQ(ERR_CONNECTION_CLOSED, sock_->Read(NULL, 1, NULL)); ASSERT_EQ(ERR_CONNECTION_CLOSED, sock_->Read(NULL, 1, NULL)); + ASSERT_FALSE(sock_->IsConnectedAndIdle()); } // Read pending when socket is closed should return 0 |