summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-05-31 10:15:55 (GMT)
committerJiang Jiang <jiang.jiang@nokia.com>2011-05-31 10:20:03 (GMT)
commit348894a550510e54e7709d18676b4b10c9e5e9e3 (patch)
treeb12e5214142aa76cb0b17b7fa80014168536cbe1
parente159f97f6ecefb49d50a82b1084fd1b1b9e5e2cf (diff)
downloadQt-348894a550510e54e7709d18676b4b10c9e5e9e3.zip
Qt-348894a550510e54e7709d18676b4b10c9e5e9e3.tar.gz
Qt-348894a550510e54e7709d18676b4b10c9e5e9e3.tar.bz2
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
-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 aac159e..6872cfa 100644
--- a/src/gui/image/qpixmap_mac.cpp
+++ b/src/gui/image/qpixmap_mac.cpp
@@ -637,7 +637,7 @@ void QMacPixmapData::macCreatePixels()
}
if (pixels)
- memcpy(base_pixels, pixels, pixelsSize);
+ memcpy(base_pixels, pixels, qMin(pixelsSize, (uint) numBytes));
pixels = base_pixels;
pixelsSize = numBytes;
}