qt5base-lts/tests/auto/widgets/kernel/qapplication
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
..
desktopsettingsaware Update copyright headers 2015-02-11 06:49:51 +00:00
modal Update copyright headers 2015-02-11 06:49:51 +00:00
test Fix compilation for WinRT 2015-12-14 08:43:15 +00:00
tmp Moved tests into integrationtests/ and widgets/ 2011-10-20 19:45:41 +02:00
.gitignore Moved tests into integrationtests/ and widgets/ 2011-10-20 19:45:41 +02:00
BLACKLIST Blacklist and skip various tests that are flakey 2015-06-14 10:50:45 +00:00
heart.svg Moved tests into integrationtests/ and widgets/ 2011-10-20 19:45:41 +02:00
qapplication.pro Fix compilation for WinRT 2015-12-14 08:43:15 +00:00
tst_qapplication.cpp tst_QApplication: Fix UBs (invalid cast) in focusMouseClick() 2016-09-28 04:56:34 +00:00