forked from qt-creator/qt-creator
LSP: seek input buffer to the end before writing to it
If we receive messages with incomplete header we seek to the position before we started to read any data from the buffer. Writing to this buffer where the current position is not at the end results in misordered data. Change-Id: Ifaea5c07abee59c803ed08094ed1fdaf40d1cb7b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -645,6 +645,8 @@ bool BaseClient::sendWorkspceFolderChanges() const
|
||||
void BaseClient::parseData(const QByteArray &data)
|
||||
{
|
||||
const qint64 preWritePosition = m_buffer.pos();
|
||||
if (!m_buffer.atEnd())
|
||||
m_buffer.seek(preWritePosition + m_buffer.bytesAvailable());
|
||||
m_buffer.write(data);
|
||||
m_buffer.seek(preWritePosition);
|
||||
while (!m_buffer.atEnd()) {
|
||||
|
||||
Reference in New Issue
Block a user