From 46355888b823b563db928faec59b0312a05e1143 Mon Sep 17 00:00:00 2001 From: Marti Maria Date: Mon, 18 Mar 2024 09:13:15 +0100 Subject: [PATCH] Bump version, add a check and a control for visibility Add a check so cmsCreatedExtendedTransform behaves like other transform generators Add a #define symbol to control visibility in linux. Useful if you want to create a so that contains lcms as static library. Bump version number --- include/lcms2.h | 6 +++--- src/cmsxform.c | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/lcms2.h b/include/lcms2.h index 12c5f89e..ee61ba71 100644 --- a/include/lcms2.h +++ b/include/lcms2.h @@ -23,7 +23,7 @@ // //--------------------------------------------------------------------------------- // -// Version 2.16 +// Version 2.17alpha0 // #ifndef _lcms2_H @@ -84,7 +84,7 @@ extern "C" { #endif // Version/release -#define LCMS_VERSION 2160 +#define LCMS_VERSION 2170 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED @@ -248,7 +248,7 @@ typedef int cmsBool; # define CMSAPI # endif #else // not Windows -# ifdef HAVE_FUNC_ATTRIBUTE_VISIBILITY +# if defined(HAVE_FUNC_ATTRIBUTE_VISIBILITY) && !defined(CMS_NO_VISIBILITY) # define CMSEXPORT # define CMSAPI __attribute__((visibility("default"))) # else diff --git a/src/cmsxform.c b/src/cmsxform.c index 45445553..99e9bb96 100644 --- a/src/cmsxform.c +++ b/src/cmsxform.c @@ -1131,7 +1131,15 @@ cmsHTRANSFORM CMSEXPORT cmsCreateExtendedTransform(cmsContext ContextID, cmsColorSpaceSignature EntryColorSpace; cmsColorSpaceSignature ExitColorSpace; cmsPipeline* Lut; - cmsUInt32Number LastIntent = Intents[nProfiles-1]; + cmsUInt32Number LastIntent; + + // Safeguard + if (nProfiles <= 0 || nProfiles > 255) { + cmsSignalError(ContextID, cmsERROR_RANGE, "Wrong number of profiles. 1..255 expected, %d found.", nProfiles); + return NULL; + } + + LastIntent = Intents[nProfiles - 1]; // If it is a fake transform if (dwFlags & cmsFLAGS_NULLTRANSFORM)