qt5base-lts/tests/auto
Marc Mutz f5291bf8b4 Fix UB in tst_QObject::noDeclarativeParentChangedOnDestruction()
If QObjectPrivate::declarativeData is set, it is
in various places in Qt expected to point to a
QAbstractDeclarativeDataImpl, from which ownedByQml1
is unconditionally read.

In noDeclarativeParentChangedOnDestruction(), the
declarativeData pointer is, however, set to a local
QAbstractDeclarativeData instance, which, being an
empty class, has size 1 and alignment 1.

Depending on the compiler's idea of bit field order,
this code either read uninitialized data from the
dummy object, or else some random stack memory outside
any (valid) object.

What caught UBSan's attention, though, was the
difference in alignment between the two classes:

  src/corelib/kernel/qobject.cpp:917:9: runtime error: member access within misaligned address 0x7fffc9cf706f for type 'struct QAbstractDeclarativeDataImpl', which requires 4 byte alignment

Fix by providing a properly initialized object of the
correct type.

Change-Id: Iae83a949ee5a7bc98df13e35ea614c063085fa13
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-07 13:00:28 +00:00
..
android Fix typo in test results report for android 2015-07-28 21:16:19 +00:00
bic/data bic: Add 5.{1,2,3,4}.0 bic data for linux-gcc-amd64 2015-02-14 06:54:20 +00:00
cmake CMake: Fix regression with quoted OPTIONS parameter 2015-03-11 07:31:33 +00:00
compilerwarnings/data Fixed license headers 2015-02-17 18:46:09 +00:00
concurrent Fix build of tests on QNX. 2015-03-14 07:05:34 +00:00
corelib Fix UB in tst_QObject::noDeclarativeParentChangedOnDestruction() 2016-01-07 13:00:28 +00:00
dbus Autotest: rename sub tests from "test" to something meaningful 2015-07-18 02:22:40 +00:00
gui Allow socket events processing with a foreign event loop on Windows 2016-01-05 13:05:35 +00:00
guiapplauncher Fix path to examples part of tst_GuiAppLauncher 2015-02-13 07:28:15 +00:00
installed_cmake Add a unit test for testing Qt in its install location. 2013-07-02 23:08:54 +02:00
network QAbstractSocket: do not enable read notifications on TCP in bind() 2015-12-24 14:05:26 +00:00
opengl Update copyright headers 2015-02-11 06:49:51 +00:00
other Fix timeout calculations using qt_subtract_from_timeout 2015-12-21 22:26:40 +00:00
printsupport Update copyright headers 2015-02-11 06:49:51 +00:00
shared Update copyright headers 2015-02-11 06:49:51 +00:00
sql fix usage of wince scope 2015-06-05 10:29:10 +00:00
testlib Change how QDebug escapes QStrings in the output 2015-08-06 04:53:38 +00:00
tools Make QDir::relativeFilePath() return "." for a path to itself. 2015-06-24 15:43:58 +00:00
widgets Revert "Fix global coordinate mapping for child widgets in QGraphicsView." 2016-01-05 08:18:18 +00:00
xml Update copyright headers 2015-02-11 06:49:51 +00:00
auto.pro fix usage of wince scope 2015-06-05 10:29:10 +00:00
network-settings.h Update copyright headers 2015-02-11 06:49:51 +00:00
qtest-config.h Update copyright headers 2015-02-11 06:49:51 +00:00
test.pl Update copyright headers 2015-02-11 06:49:51 +00:00