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

Possible null pointer dereference in qpixmap.cpp

    XMLWordPrintable

Details

    • ee5077daf59f24ca535302799ad718935e6bc4b8 (qt/qtbase/dev) 6d5c61bd7c15f81c81c08e84e09b25180782d98f (qt/qtbase/6.2)

    Description

      Issue

      See https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/image/qpixmap.cpp#n78

      qt_pixmap_thread_test() only checks for the presence of QCoreApplication, not QGuiApplication. As a result, it is possible for the function to dereference the nullptr returned by QGuiApplicationPrivate::platformIntegration() if the function is triggered without a QGuiApplication present.

      Suggestion

      Check for a QGuiApplication instead of just a QCoreApplication.

      This way, even if a user (illegally) creates a QPixmap without a QGuiApplication, they will get a qFatal() assertion with a proper explanation, instead of a segfault without explanation.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vgt Eirik Aavitsland
            skoh-qt Sze Howe Koh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes