summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2012-06-20 13:45:32 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-21 12:50:08 +0200
commitfde71d1ae7d6795a2eb56d7c422a1674058bac78 (patch)
treea6b35758c344d65c15ab2acddd2a9ebe1701f9af
parentf717c19469bff6b2de84e70b0f5725e546a7636d (diff)
Fix possible crash when copying QImage.
Task-number: QTBUG-14766 Change-Id: I82a4736dbd5ac08ede1b2bdccfa29a2009ebb4d8 Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
-rw-r--r--src/gui/image/qimage.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 91af774eef..0b330107f6 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1117,7 +1117,7 @@ QImage QImage::copy(const QRect& r) const
// Qt for Embedded Linux can create images with non-default bpl
// make sure we don't crash.
if (image.d->nbytes != d->nbytes) {
- int bpl = image.bytesPerLine();
+ int bpl = qMin(bytesPerLine(), image.bytesPerLine());
for (int i = 0; i < height(); i++)
memcpy(image.scanLine(i), scanLine(i), bpl);
} else