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

Unified Diff: google_apis/gcm/base/socket_stream.cc

Issue 600223003: [GCM] Investigatory CHECKs for crash in parsing stream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « google_apis/gcm/base/socket_stream.h ('k') | google_apis/gcm/base/socket_stream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gcm/base/socket_stream.cc
diff --git a/google_apis/gcm/base/socket_stream.cc b/google_apis/gcm/base/socket_stream.cc
index 14889e1f1180d3e0b45ba3a1db6d517c7f012697..edf723cdabdaf4931c4402f3b45b741925385cf6 100644
--- a/google_apis/gcm/base/socket_stream.cc
+++ b/google_apis/gcm/base/socket_stream.cc
@@ -56,8 +56,9 @@ bool SocketInputStream::Next(const void** data, int* size) {
void SocketInputStream::BackUp(int count) {
DCHECK(GetState() == READY || GetState() == EMPTY);
- DCHECK_GT(count, 0);
- DCHECK_LE(count, next_pos_);
+ // TODO(zea): investigating crbug.com/409985
+ CHECK_GT(count, 0);
+ CHECK_LE(count, next_pos_);
next_pos_ -= count;
DVLOG(1) << "Backing up " << count << " bytes in input buffer. "
@@ -76,7 +77,7 @@ int64 SocketInputStream::ByteCount() const {
return next_pos_;
}
-size_t SocketInputStream::UnreadByteCount() const {
+int SocketInputStream::UnreadByteCount() const {
DCHECK_NE(GetState(), CLOSED);
DCHECK_NE(GetState(), READING);
return read_buffer_->BytesConsumed() - next_pos_;
@@ -137,6 +138,8 @@ void SocketInputStream::RebuildBuffer() {
DVLOG(1) << "Have " << unread_data_size << " unread bytes remaining.";
}
read_buffer_->DidConsume(unread_data_size);
+ // TODO(zea): investigating crbug.com/409985
+ CHECK_GE(UnreadByteCount(), 0);
}
net::Error SocketInputStream::last_error() const {
@@ -179,6 +182,8 @@ void SocketInputStream::RefreshCompletionCallback(
DCHECK_GT(result, 0);
last_error_ = net::OK;
read_buffer_->DidConsume(result);
+ // TODO(zea): investigating crbug.com/409985
+ CHECK_GT(UnreadByteCount(), 0);
DVLOG(1) << "Refresh complete with " << result << " new bytes. "
<< "Current position " << next_pos_
« no previous file with comments | « google_apis/gcm/base/socket_stream.h ('k') | google_apis/gcm/base/socket_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698