diff options
author | Michal Klocek <michal.klocek@qt.io> | 2020-12-08 11:04:23 +0100 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2020-12-21 10:35:16 +0000 |
commit | b770b7517d30dd17d1096a0bb434677a2b3ff630 (patch) | |
tree | 1832f8ca12eecb58f2088430f45fc915826b3205 /src | |
parent | 31396f0affa0464c5d504cea7632f775c4456780 (diff) |
Fix crash on reallocateAndGrow
After 6be398 few tests fail/crash with qtcharts.
Fix issue on reallocateAndGraw and avoid accessing
flags on invalid header.
Data::allocate can return invalid header and dataptr,
which takes place if capacity is 0. In code before 6be398
clone method checks if header is not null before resetting
flags. However after b76fbb4 resetting flags is no longer
needed since it is done in allocateGrow.
Task-number: QTBUG-89092
Pick-to: 6.0
Change-Id: I2fde781dad7a0694a5f17ab716f647c2e35f4ff0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qarraydatapointer.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h index aa94819b35..f6aabeee65 100644 --- a/src/corelib/tools/qarraydatapointer.h +++ b/src/corelib/tools/qarraydatapointer.h @@ -189,6 +189,7 @@ public: QArrayDataPointer dp(allocateGrow(*this, n, where)); if (where == QArrayData::GrowsAtBeginning) { + Q_ASSERT(dp.ptr); dp.ptr += n; Q_ASSERT(dp.freeSpaceAtBegin() >= n); } else { @@ -202,7 +203,6 @@ public: dp->copyAppend(begin(), begin() + toCopy); else dp->moveAppend(begin(), begin() + toCopy); - dp.d->flags = flags(); Q_ASSERT(dp.size == toCopy); } |