Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
4.5.2
-
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.