Fix possible crash when copying QImage.
Task-number: QTBUG-14766 Change-Id: I82a4736dbd5ac08ede1b2bdccfa29a2009ebb4d8 Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
This commit is contained in:
parent
f717c19469
commit
fde71d1ae7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user