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 <gunnar.sletta@jollamobile.com>
bb10
Allan Sandfeld Jensen 2014-08-20 12:18:37 +02:00
parent 198009db79
commit 9b11f0bac8
1 changed files with 3 additions and 1 deletions

View File

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