summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-20 10:07:22 +0000
committerukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-20 10:07:22 +0000
commit0920251cc2c173ce824064df8360f9af8dcdfcce (patch)
treeed134e58d17de188cfdf5fbd37912ff381bec532 /net
parent2592daa9bf0c5ed165ea1b648b8a50c94431187c (diff)
downloadchromium_src-0920251cc2c173ce824064df8360f9af8dcdfcce.zip
chromium_src-0920251cc2c173ce824064df8360f9af8dcdfcce.tar.gz
chromium_src-0920251cc2c173ce824064df8360f9af8dcdfcce.tar.bz2
Fix crash bug at net::WebSocketJob::OnSentData.
According to crash dump, I suspect it is crashed at current_buffer_->DidConsume() where current_buffer_ is NULL. If current_buffer_ is NULL, WebSocketJob doesn't think there are writing data and nothing to do, so this CL changes to just return from net::WebSocketJob::OnSentData in this case. Also checks if amount_sent is negative or zero and return if it is so. BUG=91591 TEST=none Review URL: http://codereview.chromium.org/7923004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101942 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/socket_stream/socket_stream.cc2
-rw-r--r--net/websockets/websocket_job.cc7
2 files changed, 6 insertions, 3 deletions
diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc
index 159779a..8ea686a 100644
--- a/net/socket_stream/socket_stream.cc
+++ b/net/socket_stream/socket_stream.cc
@@ -418,7 +418,7 @@ void SocketStream::OnReadCompleted(int result) {
}
void SocketStream::OnWriteCompleted(int result) {
- if (result >= 0 && write_buf_) {
+ if (result > 0 && write_buf_) {
result = DidSendData(result);
}
DoLoop(result);
diff --git a/net/websockets/websocket_job.cc b/net/websockets/websocket_job.cc
index 72796b1..cbf7592 100644
--- a/net/websockets/websocket_job.cc
+++ b/net/websockets/websocket_job.cc
@@ -212,6 +212,7 @@ void WebSocketJob::OnConnected(
void WebSocketJob::OnSentData(SocketStream* socket, int amount_sent) {
DCHECK_NE(INITIALIZED, state_);
+ DCHECK_GT(amount_sent, 0);
if (state_ == CLOSED)
return;
if (state_ == CONNECTING) {
@@ -220,8 +221,10 @@ void WebSocketJob::OnSentData(SocketStream* socket, int amount_sent) {
}
if (delegate_) {
DCHECK(state_ == OPEN || state_ == CLOSING);
- DCHECK_GT(amount_sent, 0);
- DCHECK(current_buffer_);
+ if (current_buffer_ == NULL) {
+ VLOG(1) << "OnSentData current_buffer=NULL amount_sent=" << amount_sent;
+ return;
+ }
current_buffer_->DidConsume(amount_sent);
if (current_buffer_->BytesRemaining() > 0)
return;