- 
    
Bug
 - 
    Resolution: Done
 - 
    
P3: Somewhat important
 - 
    4.8.6, 5.3.1
 - 
    None
 - 
    Windows, Max OS, Linux
 
- 
        0afc80c9225ca9630f627fe1aea3d4fd7f958082 416272fbc4a6b88433eed7f01a37dd77b02b327f
 
When scaling images with big width, e.g. (60000x1), there is a crash internally in Qt.
When no crash happens part of the scaled image is corrupted.
This is a simple code snippet to reproduce the problem
QImage img(QSize(60000, 1), QImage::Format_RGB32);
img.fill(Qt::black);
QImage imgScaled = img.scaled(QSize(600, 1), Qt::KeepAspectRatio);
imgScaled.save("a.bmp");
The crash is due to an integer overflow happening both in internal functions qt_scale_image_16bit and qt_scale_image_32bit (implemented in src/gui/painting/qblendfunctions_p.h) in internal loop when srcx counter is increased.
The problem affects latest Qt 4 and Qt 5 versions (Qt 5.3.1 and Qt 4.8.6) on all platforms I tested (Windows, Mac, Linux)