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 <jiang.jiang@nokia.com>
bb10
Jiang Jiang 2011-05-31 12:15:55 +02:00 committed by Qt by Nokia
parent 1f8418807a
commit b2a8832a10
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}