Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
6.5.0
-
None
Description
QByteArrayView isn't working properly when instantiated with a QByteArray. To repro, run the following test code and compare the two checksums. The "checksum2" case was equivalent to the "checksum1" case until roughly Qt 6.0 to 6.2. Then something changed in QByteArrayView and checksums in my products - which used the "checksum2" method - started failing. (I'm a commercial licensee on the startup license, so I can't submit support requests directly.)
int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); // Put some data in the byte array QByteArray ba; for (int i = 0; i < 22; i++) ba.append(i); // Correct checksum QByteArray ba_left1 = ba.left(20); QByteArrayView bav1(ba_left1); quint16 checksum1 = qChecksum(bav1); // Incorrect checksum QByteArrayView bav2(ba.left(20)); quint16 checksum2 = qChecksum(bav2); return a.exec(); }