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

QImage::create Dvision by zero crash

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 5.1.1, 5.3.0 Alpha
    • Core: Other, GUI: Painting
    • None

    Description

      Today we got a nice long Mac OS X crashlog culminating in

      QtGui 0x0000000104a23b41 QImageData::create(unsigned char*, int, int, int, QImage::Format, bool, void (void*), void*) + 161

      Reason is supposedly in line 783

          if (width <= 0 || height <= 0 || !data
              || INT_MAX/sizeof(uchar *) < uint(height)
      	|| INT_MAX/uint(depth) < uint(width)
      	|| bpl <= 0
              || height <= 0
              || bpl < min_bytes_per_line
              || INT_MAX/uint(bpl) < uint(height))
              return d;                                        // invalid parameter(s)   
      

      depth could be 0 , as qtbase/lib/QtGui.framework/Versions/5/Headers/5.1.1/QtGui/private/qimage_p.h

      returns 0 when it gets fed an invalid enumerator:

      inline int qt_depthForFormat(QImage::Format format)
      {
          int depth = 0;
          switch(format) {
          case QImage::Format_Invalid:
          case QImage::NImageFormats:
              Q_ASSERT(false);
          case QImage::Format_Mono:
          case QImage::Format_MonoLSB:
              depth = 1;
              break;
          case QImage::Format_Indexed8:
              depth = 8;
              break;
          case QImage::Format_RGB32:
          case QImage::Format_ARGB32:
          case QImage::Format_ARGB32_Premultiplied:
              depth = 32;
              break;
          case QImage::Format_RGB555:
          case QImage::Format_RGB16:
          case QImage::Format_RGB444:
          case QImage::Format_ARGB4444_Premultiplied:
              depth = 16;
              break;
          case QImage::Format_RGB666:
          case QImage::Format_ARGB6666_Premultiplied:
          case QImage::Format_ARGB8565_Premultiplied:
          case QImage::Format_ARGB8555_Premultiplied:
          case QImage::Format_RGB888:
              depth = 24;
              break;
          }
          return depth;
      }
      

      The real reason must be somewhere down in the crashlog, of course.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            peterbruells Petern Brülls
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes