qt5base-lts/tests/auto/corelib/text/qbytearray
Mårten Nordheim 4660a230d5 QString/QByteArray: fix append() wrt. raw data
When appending to an empty string or byte array, we optimize and
copy the internal pointer. But if the other string/byte array was
created with fromRawData this might be temporary data on the stack/heap
and might be de-allocated or overwritten before the string/byte array
is used or is forced to make a deep-copy. This would lead to incorrect
data being used.

This is easy to overlook if you plan to append multiple strings
together, potentially supplied through an argument. Upon appending a
second string it would make a full copy, but there might not be a
guarantee for that. So, it's hard for users to avoid this pitfall!

Fixes: QTBUG-115752
Pick-to: 6.6 6.5 6.2
Change-Id: Ia9aa5f463121c2ce2e0e8eee8a6c8612b7297f2b
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-21 23:27:56 +02:00
..
.gitignore Move text-related code out of corelib/tools/ to corelib/text/ 2019-07-10 17:05:30 +02:00
CMakeLists.txt CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
tst_qbytearray_mac.mm Move QMacAutoReleasePool from qglobal.h to qcore_mac_p.h 2022-09-01 13:26:30 +02:00
tst_qbytearray.cpp QString/QByteArray: fix append() wrt. raw data 2023-08-21 23:27:56 +02:00