Added limit to maximum number of channels

This commit is contained in:
Mirco Miranda
2026-06-05 14:56:08 +02:00
committed by Mirco Miranda
parent 8bfdef2e48
commit 52045ff84d
5 changed files with 13 additions and 14 deletions

View File

@@ -728,7 +728,7 @@ static bool IsValid(const PSDHeader &header)
}
// Specs tells: "Supported range is 1 to 56" but when the alpha channel is present the limit is 57:
// Photoshop does not make you add more (see also 53alphas.psd test case).
if (header.channel_count < 1 || header.channel_count > 57) {
if (header.channel_count < 1 || header.channel_count > std::min(57, KIF_MAX_IMAGE_CHANNELS)) {
qCDebug(LOG_PSDPLUGIN) << "PSD header: invalid number of channels" << header.channel_count;
return false;
}