diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-09-27 13:59:37 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-09-28 04:56:34 +0000 |
commit | 5571d2bf62a69f2422a849a8d0cd2c40c35b8d47 (patch) | |
tree | ea29ded039588e2bb5a1f8e8ada5c301f994fb7e /src/widgets | |
parent | b9e42067268bc80d126e82c4d892ffe33bb4c17a (diff) |
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>
Diffstat (limited to 'src/widgets')
0 files changed, 0 insertions, 0 deletions