summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-05-31 12:15:55 +0200
committerQt by Nokia <qt-info@nokia.com>2011-07-14 09:27:15 +0200
commitb2a8832a10b8b57aaff0e92fc31a2f6326a4822d (patch)
tree8a7db7f4c527ad975e447c16239e7a83461c5380
parent1f8418807a44761716aaff53b92164a4d2523a9d (diff)
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>
-rw-r--r--src/gui/image/qpixmap_mac.cpp2
1 files changed, 1 insertions, 1 deletions
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;
}