diff options
author | Marc Mutz <[email protected]> | 2025-03-22 17:56:55 +0100 |
---|---|---|
committer | Marc Mutz <[email protected]> | 2025-03-23 13:25:39 +0100 |
commit | f4dd7e29a68c4439e3da40db4eb2d67999d316b0 (patch) | |
tree | c3ec6a4fbf75b6a99103dfbcc7b25cc0a126621e /src/concurrent/qtconcurrentmap.cpp | |
parent | 22e212b6855f0e351b3b6a5a22b108e0bb53b986 (diff) |
QMessageBox: really fix UB (invalid cast) in Private::canBeNativeDialog()
The code comment above the cast is correct, but the code wasn't: While
we're receiving the result of the cast in a QDialog pointer, the cast
is still to QMessageBox*, and whether that cast is in the Q_Q macro or
not doesn't change the fact that it's invalid.
Says UBSan:
qmessagebox.cpp:2804:31: runtime error: downcast of address 0x7ffebfd87140 which does not point to an object of type 'QMessageBox'
0x7ffebfd87140: note: object is of type 'QDialog'
2b 7f 00 00 30 94 57 b9 2b 7f 00 00 80 8c 00 00 90 61 00 00 08 96 57 b9 2b 7f 00 00 00 00 d8 bf
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QDialog'
The trivial fix is to cast only to QDialog.
Amends 29b2506e8cf0c792821a3ddb28e62080cd66ae28.
Pick-to: 6.9 6.8
Change-Id: Ia3f6c08b62f6bed274f43baab881a0d802bd986b
Reviewed-by: Thorbjørn Lund Martsum <[email protected]>
Diffstat (limited to 'src/concurrent/qtconcurrentmap.cpp')
0 files changed, 0 insertions, 0 deletions