qt5base-lts/tests/auto/widgets/kernel
Marc Mutz 5571d2bf62 tst_QApplication: Fix UBs (invalid cast) in focusMouseClick()
Found by UBSan:

  tst_qapplication.cpp:1754:48: runtime error: member access within address 0x7ffda11f2220 which does not point to an object of type 'SpontaneousEvent'
  0x7ffda11f2220: note: object is of type 'QMouseEvent'

The code attempted to model the layout of a QEvent with another class
that allows public access to the memory location that (hopefully)
corresponds to QEvent::spont, gaining access by casting a QEvent
object to that specifically-crafted class.

Fix by the using the existing QSpontaneKeyEvent::setSpontaneous()
call, which, despite its name, works for all QEvent subclasses, and
which has already been fixed to not invoke UB (in bc087db).

Change-Id: I7db8b8a8a823f7d61ab17375142d19dc3874fea5
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-09-28 04:56:34 +00:00
..
qaction tests/auto/widgets: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b). 2015-07-31 11:50:10 +00:00
qactiongroup tests/auto/widgets: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b). 2015-07-31 11:50:10 +00:00
qapplication tst_QApplication: Fix UBs (invalid cast) in focusMouseClick() 2016-09-28 04:56:34 +00:00
qboxlayout Plug memleaks in tst_QBoxLayout 2016-09-27 06:30:29 +00:00
qdesktopwidget Add check for top level widget leaks in kernel test of QtWidgets. 2015-06-16 14:14:18 +00:00
qformlayout tests/auto/widgets: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b). 2015-07-31 11:50:10 +00:00
qgridlayout Plug memleaks in tst_QGridLayout 2016-09-27 06:30:34 +00:00
qlayout tests/auto/widgets: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b). 2015-07-31 11:50:10 +00:00
qshortcut Fix reentrancy regression in QShortcutMap after c7e5e1d9e 2016-01-12 22:08:04 +00:00
qsizepolicy Add check for top level widget leaks in kernel test of QtWidgets. 2015-06-16 14:14:18 +00:00
qstackedlayout Update copyright headers 2015-02-11 06:49:51 +00:00
qtooltip Merge remote-tracking branch 'origin/5.5' into dev 2015-07-01 11:05:26 +02:00
qwidget QtWidgets: Fix enter/leave events on popup menus 2016-09-15 10:16:44 +00:00
qwidget_window QtWidgets: Reduce paint events when resizing native widget 2016-05-19 10:11:27 +00:00
qwidgetaction tests/auto/widgets: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b). 2015-07-31 11:50:10 +00:00
qwidgetmetatype Update copyright headers 2015-02-11 06:49:51 +00:00
qwidgetsvariant tests/auto/widgets: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b). 2015-07-31 11:50:10 +00:00
qwindowcontainer QtWidgets: Allow to cover up the window container by another widget 2016-01-28 17:40:53 +00:00
kernel.pro Introducing QWidget::createWindowContainer() 2013-01-25 14:11:07 +01:00