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

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

    XMLWordPrintable

Details

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

    Description

      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
      

      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
              shmittal Shveta Mittal
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes