diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-01-09 06:13:13 -0800 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-03-16 19:04:02 +0000 |
commit | a457e9245173621c8c718611d1515e24803aabe5 (patch) | |
tree | d19ab19be95c72a17607fd038e54d53512334aa4 /tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp | |
parent | 27af1b9dc42c6b3eeade9bec1943c1e6527b14d0 (diff) |
QByteArray: fix append() with a negative length
The documentation says that if it's negative, we find the null
termination. This bug was introduced with the clean up to use
QByteArrayView in commit 8897aa071a668563a53a4c2e6909572f1762b1e7.
Fixes: QTBUG-99640
Change-Id: Ib42b3adc93bf4d43bd55fffd16c89fa4a960f3a9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit bb35b2f64dfa18c491aed8b8103941325df3228b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp')
-rw-r--r-- | tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp index 05116f99c9..073bb2dc08 100644 --- a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp @@ -958,6 +958,7 @@ void tst_QByteArray::append() QCOMPARE(QByteArray().append(2, 'a'), QByteArray("aa")); QCOMPARE(QByteArray().append(QByteArray("data")), QByteArray("data")); QCOMPARE(QByteArray().append(data), QByteArray("data")); + QCOMPARE(QByteArray().append(data, -1), QByteArray("data")); QCOMPARE(QByteArray().append(data, 2), QByteArray("da")); QCOMPARE(QByteArray().append(QByteArrayView(data)), QByteArray("data")); |