Skip to content

Commit

Permalink
Add an extra check for floating-point formats in two helper functions
Browse files Browse the repository at this point in the history
Should fix #461
  • Loading branch information
mm2 committed Oct 16, 2024
1 parent 5c54a6d commit 47a261e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cmspack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit 47a261e

Please sign in to comment.