From b2a8832a10b8b57aaff0e92fc31a2f6326a4822d Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Tue, 31 May 2011 12:15:55 +0200 Subject: Avoid buffer overrun in QMacPixmapData resizing Shouldn't use size bigger than the original (source) pixels buffer or the new one (just allocated). Task-number: QTBUG-18547 Reviewed-by: aavit (cherry picked from commit 348894a550510e54e7709d18676b4b10c9e5e9e3) Change-Id: I7cc373b7d0f1ffef2d2f0cdddb7018c856849d29 Reviewed-on: http://codereview.qt.nokia.com/1635 Reviewed-by: Jiang Jiang --- src/gui/image/qpixmap_mac.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index cb3016177d..bdf1f90d8c 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -648,7 +648,7 @@ void QMacPixmapData::macCreatePixels() } if (pixels) - memcpy(base_pixels, pixels, pixelsSize); + memcpy(base_pixels, pixels, qMin(pixelsSize, (uint) numBytes)); pixels = base_pixels; pixelsSize = numBytes; } -- cgit v1.2.3