QImage::setAlphaChannel(): Check result of image conversion

alphaChannel.convertToFormat() may fail due to OOM. Check the obtained
image.

Task-number: QTBUG-54873
Change-Id: I778b7de7de611105fe23c1c24cbd69bd8f7c72d9
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Friedemann Kleint 2016-07-21 15:16:58 +02:00
parent 49926bb9ef
commit 5123dba564

View File

@ -4233,6 +4233,8 @@ void QImage::setAlphaChannel(const QImage &alphaChannel)
} else { } else {
const QImage sourceImage = alphaChannel.convertToFormat(QImage::Format_RGB32); const QImage sourceImage = alphaChannel.convertToFormat(QImage::Format_RGB32);
if (sourceImage.isNull())
return;
const uchar *src_data = sourceImage.d->data; const uchar *src_data = sourceImage.d->data;
uchar *dest_data = d->data; uchar *dest_data = d->data;
for (int y=0; y<h; ++y) { for (int y=0; y<h; ++y) {