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

QImage::fill() behaves differently to QImage::setPixel() on indexed image, out-of-range

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 4.5.2
    • Image formats
    • None
    • Qt 4.5.2 or 4.4.3 under Debian GNU/Linux

    Description

      QImage labels(image.width, image.height, QImage::Format_Indexed8);
      labels.fill(255); // works
      labels->setPixel(x, y, 255); // does not work, message at runtime: QImage::setPixel: Index 255 out of range

      Correct code that avoids undefined behaviour:
      QImage labels(image.width, image.height, QImage::Format_Indexed8);
      labels.setNumColors(255);
      labels.fill(255);

      I assume fill() should also check the index range to avoid undefined behaviour.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            ypnos Johannes Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes