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

QImage::reinterpretAsFormat crash when out of memory

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.12.0 Beta 2
    • 5.10.1
    • GUI: Painting
    • None
    • Windows 7 64 bit
      msvc2015

    Description

      QImage::reinterpretAsFormat does not contain check if d==null after detach(), but d==null is possible when out of memory.

      Example:

      #include <QList>
      #include <QImage>

      int main(int argc, char *argv[])
      {
      QList<QImage> images;
      int h = 10000;
      while (true) {
      int w = h / 2;
      QImage img = QImage(h, w, QImage::Format_ARGB32_Premultiplied);
      if (img.isNull())

      { break; }

      images << img;
      }

      QImage img = images.at(0);
      img.reinterpretAsFormat(QImage::Format_ARGB32);
      }

      Attachments

        1. QImageBug.zip
          4 kB
        2. screen.png
          screen.png
          51 kB
        For Gerrit Dashboard: QTBUG-70785
        # Subject Branch Project Status CR V

        Activity

          People

            allan.jensen Allan Sandfeld Jensen
            ag3nt Dmitriy Gilfanov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes