Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-112698

QByteArrayView problem

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 6.5.0
    • Core: Other
    • None
    • macOS, Windows

    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();
      }
      

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            mjsmithers Michael Smithers
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes