From 38726b19c0d89b135c1f92d931f64532f48e4597 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Wed, 20 Jun 2012 13:45:32 +0200 Subject: Fix possible crash when copying QImage. Task-number: QTBUG-14766 Change-Id: I0b9ec19ea43355e04a12f2dc0244b22b575fab44 Reviewed-by: Gunnar Sletta --- src/gui/image/qimage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index f8f81e9..24650ba 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -1400,7 +1400,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 -- cgit v0.12