Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-41231

Results of malloc aren't checked for 0 when called from QArrayData::allocate

    XMLWordPrintable

Details

    • 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

        Activity

          People

            thiago Thiago Macieira
            ulherman Ulf Hermann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes