The Qt app can freeze forever if the broker sends a bad message


- When QMqttConnection reads a message, it keeps a count of the bytes
left to read -> by the dataSize argument. If a read fails, the count
is never reduced.
- The fix cleaning up the count of the bytes left to read, since
the reading is not working anymore and parsing should be stopped.
It allows to get read of potential freezes.

The patch also updates the QByteArray specialization to return a
default-constructed QBA in case of an error. This is more in line
with the default implementation.

Pick-to: 6.11 6.12 6.8
Task-number: QTBUG-149563
Change-Id: I8c8c5ef354103a996ac6e360fbc5c8f61d965f3d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
commit21b866609f8f9e292fc5284dc4e7b91627c01f4d
parent6bdaef48c7ebce8f60dc1518aa8d312ab1452efd
authorTatiana Borisova <tatiana.borisova@qt.io>
committerIvan Solovev <ivan.solovev@qt.io>
commit timeTue, 15 Sep 2026 09:06:31 +0000