diff options
| author | Thiago Macieira <thiago.macieira@intel.com> | 2020-11-16 12:36:12 -0800 |
|---|---|---|
| committer | Thiago Macieira <thiago.macieira@intel.com> | 2020-12-04 20:04:14 -0800 |
| commit | aab5c8e5486a6484feddfae0b04fd39fd244d9b9 (patch) | |
| tree | da023aae29e528259eec19ef88ea1640f4317f6f /src/corelib/tools/qarraydataops.h | |
| parent | 302254f90f41509b3d1111551296134cd76a3db5 (diff) | |
QString/QByteArray: add missing Q_CHECK_PTR
So these two classes throw when trying to allocate silly sizes or in OOM
conditions.
We probably want to move these Q_CHECK_POINTER into QTypedArrayData but
I didn't want to do that in this commit.
Task-number: QTBUG-88256
Task-number: QTBUG-88253
Change-Id: Ifc61bb80b9bf48a386abfffd1648176111770174
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/tools/qarraydataops.h')
| -rw-r--r-- | src/corelib/tools/qarraydataops.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index cf054a089fd..0c7703c5880 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -286,6 +286,7 @@ public: void reallocate(qsizetype alloc, QArrayData::AllocationOption option) { auto pair = Data::reallocateUnaligned(this->d, this->ptr, alloc, option); + Q_CHECK_PTR(pair.second); Q_ASSERT(pair.first != nullptr); this->d = pair.first; this->ptr = pair.second; @@ -849,6 +850,7 @@ public: void reallocate(qsizetype alloc, QArrayData::AllocationOption option) { auto pair = Data::reallocateUnaligned(this->d, this->ptr, alloc, option); + Q_CHECK_PTR(pair.second); Q_ASSERT(pair.first != nullptr); this->d = pair.first; this->ptr = pair.second; |
