Network Remote: Check bytesAvailable >= 4 before reading length integer
This caused Clementine Remote to stop working on Android N. writeInt() splits the 4 bytes across multiple tcp frames. Clementine would read a wrong length and thus fail to read any protocol buffer data.
This commit is contained in:
parent
363e88a6c4
commit
e5ab3e786f
|
@ -64,6 +64,10 @@ void RemoteClient::setDownloader(bool downloader) { downloader_ = downloader; }
|
|||
void RemoteClient::IncomingData() {
|
||||
while (client_->bytesAvailable()) {
|
||||
if (!reading_protobuf_) {
|
||||
// If we have less than 4 byte, we cannot read the length. Wait for more data
|
||||
if (client_->bytesAvailable() < 4) {
|
||||
break;
|
||||
}
|
||||
// Read the length of the next message
|
||||
QDataStream s(client_);
|
||||
s >> expected_length_;
|
||||
|
|
Loading…
Reference in New Issue