Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.3.1, 5.4.0 Alpha
-
None
-
9d44645eae144fcfefa0de2455d41f04d29c40d4
Description
QArrayData is used as the internal storage for various classes. It allocates its memory with malloc() in qarraydata.cpp:101. If that malloc returns 0 QArrayData::allocate() will return 0, too. This can happen for a variety of reasons, few of which are under the application developer's control. The result of allocate() is used blindly in a variety of places but I can only see one place where it's actually checked for 0, qvector.h:507
All users of QArrayData need to use Q_CHECK_PTR after the allocation to check for nulls and throw if necessary.
Attachments
For Gerrit Dashboard: QTBUG-41231 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
95293,5 | Do Q_CHECK_PTR on all results of QArrayData::allocate() | dev | qt/qtbase | Status: MERGED | +2 | 0 |