[GCM] Fix crash when size packet splits two socket reads
commit7592d13c4d3b73bcfae418bf451981f72fa9bd77
authorzea <zea@chromium.org>
Tue, 21 Oct 2014 18:21:44 +0000 (21 11:21 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 21 Oct 2014 18:22:02 +0000 (21 18:22 +0000)
treec4dd71b7dd7507e256259c5441da92eae753fc78
parentab4e68f57d7648d20c9f270f8b408dd194f7cfbc
[GCM] Fix crash when size packet splits two socket reads

ByteCount(), rather than UnreadByteCount(), was being incorrectly used to
determine how to handle a size packet than needed a second byte.
ByteCount() includes read bytes, while UnreadByteCount() is the one that does
not. UnreadByteCount is the only one that should be used here. Fixed, and
added new tests.

BUG=424532

Review URL: https://codereview.chromium.org/643133003

Cr-Commit-Position: refs/heads/master@{#300525}
google_apis/gcm/engine/connection_handler_impl.cc
google_apis/gcm/engine/connection_handler_impl_unittest.cc