diff options
| author | Marc Mutz <marc.mutz@kdab.com> | 2013-09-15 03:18:11 +0200 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-21 01:25:19 +0200 |
| commit | 84033f550f5f31f6cb7609c9edacb11f51802649 (patch) | |
| tree | 37751d199604b3f3f6d24dc0649f8dfe7be923f6 /src/corelib/tools/qregexp.cpp | |
| parent | 09205d573413da8a2ac3826198fe36bb2dc4349f (diff) | |
QAnimationGroup: avoid undefined behavior
The existing code performed a downcast from QObject* to QAbstractAnimation*
at a time when the former QAbstractAnimation only is a QObject anymore.
The comment indicates that this was understood at the time of writing (or
else a little later), but it drew the wrong conclusions.
Statically downcasting a type whose dynamic type is (no longer) of the
target type is undefined behavior.
This change fixes the code to (implicitly) cast _up_ to QObject and
compare at that level.
Says Clang:
src/corelib/animation/qanimationgroup.cpp:278:33: runtime error:
downcast of address 0x000002966ab0 which does not point to an object of type 'QAbstractAnimation'
0x000002966ab0: note: object is of type 'QObject'
00 00 00 00 80 d7 e6 d7 88 2b 00 00 70 7b 96 02 00 00 00 00 61 00 6e 00 6e 00 6f 00 21 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QObject'
Change-Id: I51d6277020d0ff32cd7b80a8cddcf2cda1a626a6
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/tools/qregexp.cpp')
0 files changed, 0 insertions, 0 deletions
