Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.5.0
-
None
Description
When trying to create a large image like below, you get a null QImage.
QImage image(25000, 25000, QImage::Format_RGB32);
The code responsible for the failure is in QImageData::create() and looks like this:
// sanity check for potential overflows if (INT_MAX/depth < width || bytes_per_line <= 0 || height <= 0 || INT_MAX/uint(bytes_per_line) < height || INT_MAX/sizeof(uchar *) < uint(height)) return 0;
The particular check that fails is:
INT_MAX/uint(bytes_per_line) < height
I presume QImageData::nbytes being of type int is the primary reason to have this check.
It would be nice to remove this 2GB limitation for 64bit builds. Large images are commonly used in printing industry.