diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-13 11:31:14 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-02-20 16:11:02 +0100 |
commit | 14f1ec186f87ce50037044ccb079463676518ec5 (patch) | |
tree | 7e0918d1889cc93d52c5e996e79a733b2728e37b /src/gui/image/qpixmap_win.cpp | |
parent | a99d7cf37213f86c8be55fc80a9785ec9a0d382d (diff) |
Make bytes-per-line safe for int overflow
Goes through the Qt code and make sure bytes-per-line calculations are
safe when they are too big for 32bit integers.
Change-Id: I88b2d74b3da82e91407d316aa932a4a37587c0cf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/image/qpixmap_win.cpp')
-rw-r--r-- | src/gui/image/qpixmap_win.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp index 8aad77b991..be6cd0c5fc 100644 --- a/src/gui/image/qpixmap_win.cpp +++ b/src/gui/image/qpixmap_win.cpp @@ -121,7 +121,7 @@ static inline void copyImageDataCreateAlpha(const uchar *data, QImage *target) const uint mask = target->format() == QImage::Format_RGB32 ? 0xff000000 : 0; const int height = target->height(); const int width = target->width(); - const int bytesPerLine = width * int(sizeof(QRgb)); + const qsizetype bytesPerLine = width * sizeof(QRgb); for (int y = 0; y < height; ++y) { QRgb *dest = reinterpret_cast<QRgb *>(target->scanLine(y)); const QRgb *src = reinterpret_cast<const QRgb *>(data + y * bytesPerLine); |