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

qt6 sigsegv with QString::fromUtf16

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 6.4.1
    • None
    • Linux/Wayland

    Description

      With qt6 i can't use QString::fromUtf16 when string is unaligned. This simple example crashes:

       

      #include <QCoreApplication>
      #include <QString>
      #include <QDebug>
      
      static const int8_t g_test[12] = { 0x48, 0x0, 0x48, 0x0, 0x0, 0x48, 0x0, 0x48, 0x0, 0x0, 0x0 };
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
      
          const char* str = (const char*) g_test;
          auto t1 = QString::fromUtf16((const char16_t*) str);
      
          str += 7;
      
          // sigsegv
          auto t2 = QString::fromUtf16((const char16_t*) str);
      
          qDebug() << t1;
          qDebug() << t2;
      
          return a.exec();
      }
      

      But on same os with qt5.15.8 works fine.

      Attachments

        Issue Links

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

          Activity

            People

              thiago Thiago Macieira
              xcdix Konstantin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes