qt5base-lts/tests/auto/corelib
Fabian Kosmale 96e1381a0a QBindable: Fix out-of-bound access in non-bindable property support code
QObjectPrivate::getPropertyAdaptorSlotObject called
connectionsForSignal.
Calling this function is only safe after it has been ensured beforehand that the vector has size > signalIndex. As getPropertyAdaptorSlotObject
is not supposed to modify the vector, it does not resize the vector and it could consequently end up with an out-of-bounds read.

To avoid that issue, we instead first check if the vector can
potentially contain an entry for the signal. If not, we simply return
nullptr, and avoid the call to connectionsForSignal.

The issue and its fix can be verified by running the modified
tst_qproperty test with ASAN enabled. The test is modified in the
following way:
- We first create a signal connection to a dummy slot. Otherwise,
  connections.loadRelaxed() would return a nullptr, and the problematic
  code would never be reached.
- We add enough signals to ensure that the fooChanged signal will
  actually be out of reach (which means >= 8 signals, as the initial
  capacity of the vector is 8)
Running the test without ASAN will most likely not result in a failure,
as then the out-of-bounds read will simply read garbage, and the most
likely result is that the cast below will fail.

Pick-to: 6.6 6.5
Change-Id: I18a3c4f52769c2b6491a685abb84f6fcfb44e4d8
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-06-20 05:55:52 +00:00
..
animation QPauseAnimation test: add QNX to platforms that might fail 2023-05-25 14:06:50 +02:00
global Replace {add,sub,mul}_overload with q{Add,Sub,Mul}Overload 2023-06-12 13:11:26 +00:00
io QProcess: add testUnixProcessParameters as a dep. for tst_qprocess 2023-06-18 20:32:30 +03:00
ipc IPC: tst_QNativeIpcKey: rename duplicate row in test 2023-04-28 22:30:13 -05:00
itemmodels Remove unused variables 2023-04-19 12:55:02 +02:00
kernel QBindable: Fix out-of-bound access in non-bindable property support code 2023-06-20 05:55:52 +00:00
mimetypes QMimeDatabase: de-duplicate some code in the unittests 2023-05-07 14:29:28 +03:00
platform Don't add prefix for BaseName 2023-06-16 22:54:36 +03:00
plugin QUuid: add support for 128-bit integers 2023-05-20 04:59:43 +00:00
serialization Shoehorn AccentColor into QPalette and keep existing 64bit resolve mask 2023-05-21 18:36:37 +02:00
text QStringBuilder: allow to be used with 'auto' keyword 2023-06-13 20:01:37 +00:00
thread Long live futexes for FreeBSD! 2023-06-15 04:04:56 -07:00
time Add test-cases for QDate::{start,end}OfDay() at QDateTime's bounds 2023-05-15 14:02:41 +02:00
tools tst_containerapisymmetry: check that std::size() works 2023-06-09 12:32:48 +00:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00