qt5base-lts/tests/auto/widgets
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
..
dialogs tst_QFileSystemModel: Remove Win32LongFileName(). 2016-06-08 04:09:48 +00:00
effects Purge sRGB chunks from PNGs in tests. 2016-03-29 08:39:43 +00:00
gestures Autotest: Remove blacklistings 2016-04-01 05:41:21 +00:00
graphicsview tst_QGraphicsItem: Fix UB (invalid cast/member call) in prepareGeometryChange() 2016-09-22 15:25:18 +00:00
itemviews Don't call virtual functions with data from an old model 2016-08-04 11:48:51 +00:00
kernel tst_QApplication: Fix UBs (invalid cast) in focusMouseClick() 2016-09-28 04:56:34 +00:00
styles Enable testStyleOptionInit for all styles and fix affected styles. 2016-06-06 13:12:14 +00:00
util QCompleter::setModel(): Restore completion role 2016-07-13 13:45:44 +00:00
widgets QDateTimeEdit: synchronize time-spec before initializing display 2016-09-27 11:21:53 +00:00
widgets.pro Add autotest for QGestureRecognizer. 2014-10-23 21:11:28 +02:00