mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2026-11-18 12:08:48 -05:00
PSD: refuse one-channel grayscale images that announce an alpha channel
A grayscale image with one channel, whose resources announce an alpha channel (Alpha Identifiers), was loaded as RGBA: the alpha of each pixel was read from the gray of the next one, and for the last pixel of each line from past the end of the decoded line, a value never set. Such a file is malformed, so it is now refused.
This commit is contained in:
committed by
Albert Astals Cid
parent
5b0ed96ea9
commit
d4918186d7
@@ -632,6 +632,10 @@ static QImage::Format imageFormat(const PSDHeader &header, bool alpha)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CM_GRAYSCALE:
|
case CM_GRAYSCALE:
|
||||||
|
if (alpha && header.channel_count < 2) {
|
||||||
|
// the alpha channel announced is not in the file
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (header.depth == 32) {
|
if (header.depth == 32) {
|
||||||
format = !alpha ? QImage::Format_RGBX32FPx4 : QImage::Format_RGBA32FPx4_Premultiplied;
|
format = !alpha ? QImage::Format_RGBX32FPx4 : QImage::Format_RGBA32FPx4_Premultiplied;
|
||||||
} else if (header.depth == 16) {
|
} else if (header.depth == 16) {
|
||||||
|
|||||||
Reference in New Issue
Block a user