From f222eb1d2484764971d25871f3d796dc6ff05c1c Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Mon, 8 Jan 2024 18:12:13 +0100 Subject: [PATCH] core: ensure icc profiles contain valid colorimetry --- src/core/iccprofile.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/iccprofile.cpp b/src/core/iccprofile.cpp index 4c2ac74372..f4279647c0 100644 --- a/src/core/iccprofile.cpp +++ b/src/core/iccprofile.cpp @@ -306,6 +306,11 @@ std::unique_ptr IccProfile::load(const QString &path) } } + if (red.y() == 0 || green.y() == 0 || blue.y() == 0 || white.y() == 0) { + qCWarning(KWIN_CORE, "Profile has invalid primaries"); + return nullptr; + } + BToATagData lutData; if (cmsIsTag(handle, cmsSigBToD1Tag) && !cmsIsTag(handle, cmsSigBToA1Tag) && !cmsIsTag(handle, cmsSigBToA0Tag)) { qCWarning(KWIN_CORE, "Profiles with only BToD tags aren't supported yet");