From 47a261e0b1579558184499ae5aadd0a04b1fb76f Mon Sep 17 00:00:00 2001 From: Marti Maria Date: Wed, 16 Oct 2024 16:58:11 +0200 Subject: [PATCH] Add an extra check for floating-point formats in two helper functions Should fix #461 --- src/cmspack.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cmspack.c b/src/cmspack.c index dcd5e603..3e9d23fe 100644 --- a/src/cmspack.c +++ b/src/cmspack.c @@ -4033,6 +4033,9 @@ cmsUInt32Number CMSEXPORT cmsFormatterForColorspaceOfProfile(cmsHPROFILE hProfil // Unsupported color space? if (nOutputChans < 0) return 0; + // Fix float spaces + nBytes &= 7; + // Create a fake formatter for result return FLOAT_SH(Float) | COLORSPACE_SH(ColorSpaceBits) | BYTES_SH(nBytes) | CHANNELS_SH(nOutputChans); } @@ -4050,6 +4053,9 @@ cmsUInt32Number CMSEXPORT cmsFormatterForPCSOfProfile(cmsHPROFILE hProfile, cmsU // Unsupported color space? if (nOutputChans < 0) return 0; + // Fix float spaces + nBytes &= 7; + // Create a fake formatter for result return FLOAT_SH(Float) | COLORSPACE_SH(ColorSpaceBits) | BYTES_SH(nBytes) | CHANNELS_SH(nOutputChans); }