diff options
author | Marti Maria <marti.maria@littlecms.com> | 2022-09-01 21:36:35 +0300 |
---|---|---|
committer | Marti Maria <marti.maria@littlecms.com> | 2022-09-01 21:36:35 +0300 |
commit | 991713e8456e62de82793e0594997fe997045431 (patch) | |
tree | c3391fe5dae091e0b037ad747d877d6d017b2dad | |
parent | eaed773f8201461e7b80df5f935f6183cebda272 (diff) |
Add checks for unsupported colorspace
Those profiles are just broken.
-rw-r--r-- | src/cmsgmt.c | 3 | ||||
-rw-r--r-- | src/cmspack.c | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/cmsgmt.c b/src/cmsgmt.c index e6c27c1..d4b2d7d 100644 --- a/src/cmsgmt.c +++ b/src/cmsgmt.c @@ -472,6 +472,9 @@ cmsFloat64Number CMSEXPORT cmsDetectTAC(cmsHPROFILE hProfile) // Create a fake formatter for result
dwFormatter = cmsFormatterForColorspaceOfProfile(hProfile, 4, TRUE);
+ // Unsupported color space?
+ if (dwFormatter == 0) return 0;
+
bp.nOutputChans = T_CHANNELS(dwFormatter);
bp.MaxTAC = 0; // Initial TAC is 0
diff --git a/src/cmspack.c b/src/cmspack.c index 9d312a0..2177682 100644 --- a/src/cmspack.c +++ b/src/cmspack.c @@ -3842,6 +3842,9 @@ cmsUInt32Number CMSEXPORT cmsFormatterForColorspaceOfProfile(cmsHPROFILE hProfil cmsInt32Number nOutputChans = cmsChannelsOfColorSpace(ColorSpace); cmsUInt32Number Float = lIsFloat ? 1U : 0; + // Unsupported color space? + if (nOutputChans < 0) return 0; + // Create a fake formatter for result return FLOAT_SH(Float) | COLORSPACE_SH(ColorSpaceBits) | BYTES_SH(nBytes) | CHANNELS_SH(nOutputChans); } @@ -3856,6 +3859,9 @@ cmsUInt32Number CMSEXPORT cmsFormatterForPCSOfProfile(cmsHPROFILE hProfile, cmsU cmsUInt32Number nOutputChans = cmsChannelsOf(ColorSpace); cmsUInt32Number Float = lIsFloat ? 1U : 0; + // Unsupported color space? + if (nOutputChans < 0) return 0; + // Create a fake formatter for result return FLOAT_SH(Float) | COLORSPACE_SH(ColorSpaceBits) | BYTES_SH(nBytes) | CHANNELS_SH(nOutputChans); } |