diff options
author | Marc Mutz <marc.mutz@qt.io> | 2021-11-29 12:37:24 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2021-12-01 20:05:26 +0000 |
commit | 8444b1ed1f4eb44aabee8bed70f1d1807cb34e8e (patch) | |
tree | 32162b533a2f9f063aaecbf585867ffbf29a3ec3 /tests/auto/corelib | |
parent | 82f09a1cdaa9f0c7fc993a872086597799152f02 (diff) |
QStringView: fix split(QRegularExpression) returning invalid data
The problem was that QStringView::split(QRE) is implemented as
convert(QString::fromRawData(view.data(), view.size()).splitRef(~~~args~~~));
while the implementation caused a hidden detach by calling
QString::utf16(), which detaches fromRawData() to ensure the
terminating NUL.
Fix by using (const) data() instead, and casting.
[ChangeLog][QtCore][QRegularExpression] Fixed a bug where invalid
references could be returned for QString::fromRawData() subjects.
Fixes: QTBUG-98653
Change-Id: I0dceaf7d5fe6e5d64e7c9be81e26f0e51869f9da
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r-- | tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp index 69294e63fc..b24243b98e 100644 --- a/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp +++ b/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp @@ -2211,9 +2211,6 @@ void tst_QRegularExpression::returnsViewsIntoOriginalString() // THEN // the returned views should point into the underlying string: -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - QEXPECT_FAIL("", "QTBUG-98653", Continue); -#endif QCOMPARE(to_void(split.front().data()), stringDataAddress); } |