path: root/src/gui/image
diff options
authorAllan Sandfeld Jensen <>2014-08-20 12:18:37 +0200
committerAllan Sandfeld Jensen <>2014-08-20 15:54:41 +0200
commit9b11f0bac8f4a6b3c0b960e40bf74830eb5c1056 (patch)
tree549bc1c835438b9fb98e479012e7e16c38072be0 /src/gui/image
parent198009db79a85d3cab7fe3a6432635d36123a2d6 (diff)
Fix invalid memcpy(dst, src) calls where dst == src
The convert_generic_inline method was not correctly handling the case where both the conversion methods were passthrough and the last store is therefore not needed and may trigger an invalid memcpy call. Change-Id: Ic88780f50e1ff9dedc04b8ff1ab3527dd0c8150c Reviewed-by: Gunnar Sletta <>
Diffstat (limited to 'src/gui/image')
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index 629a7c9b69..f2f71b4bad 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -163,7 +163,9 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
const uint *ptr = fetch(buffer, srcData, x, l);
ptr = srcLayout->convertToARGB32PM(buffer, ptr, l, srcLayout, 0);
ptr = destLayout->convertFromARGB32PM(buffer, ptr, l, destLayout, 0);
- store(srcData, ptr, x, l);
+ // The conversions might be passthrough and not use the buffer, in that case we are already done.
+ if (srcData != (const uchar*)ptr)
+ store(srcData, ptr, x, l);
x += l;
srcData += data->bytes_per_line;