diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-01-09 06:13:13 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-01-11 15:12:30 +0000 |
commit | bb35b2f64dfa18c491aed8b8103941325df3228b (patch) | |
tree | 5fbf15016dd02f42cb8fdbc676d3ed55dc115a04 /tests/auto/corelib | |
parent | 17dca04a613b632d6c0d4340eedbdc86e250c455 (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
Pick-to: 6.3 6.2
Change-Id: Ib42b3adc93bf4d43bd55fffd16c89fa4a960f3a9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'tests/auto/corelib')
-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 cecd0f1584..ae65b8d27e 100644 --- a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp @@ -957,6 +957,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")); |