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.
Attachments
For Gerrit Dashboard: QTBUG-50912 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
150145,17 | Allow QImage with more than 2GByte of image data | dev | qt/qtbase | Status: MERGED | -2 | 0 |