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

QStringView::mid() does not work for length < 0

XMLWordPrintable

    • d2833a3ce5af725d66ef9338f2a61b766dd3cb2d 0e2776320cc39a95b914787d28a09c615f68b708 (qt/tqtc-qtbase/5.15)

      As mentioned in QStringView::mid(qsizetype start, qsizetype length) documentation that Since 5.15.2, the behavior is compatible with QString::mid() for length<0, But following code gives a assert hit in 5.15.2 - 5.15.4:

          QString t = "my test";
          QStringView v = t;
          auto v2 = v.mid(2,-1); // asserts on this line, in the QStringView constructor 
          qInfo() << v2;
      
      ASSERT: "len >= 0" in file C:\Qt\5.15.4\msvc2019_64\include\QtCore/qstringview.h, line 175
      

        For Gerrit Dashboard: QTBUG-93677
        # Subject Branch Project Status CR V

            thiago Thiago Macieira
            shmittal Shveta Mittal
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes