Skip to content

Commit

Permalink
eliminate arbitrary limit on CMS descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Mar 29, 2022
1 parent 5988721 commit 2c452fc
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions magick/property.c
Original file line number Diff line number Diff line change
Expand Up @@ -1708,49 +1708,58 @@ static MagickBooleanType GetICCProperty(const Image *image,const char *property)
if (name != (const char *) NULL)
(void) SetImageProperty((Image *) image,"icc:name",name);
#else
char
info[MagickPathExtent];
StringInfo
*info;

unsigned int
extent;

(void) memset(info,0,sizeof(info));
info=AcquireStringInfo(0);
extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,"en","US",
NULL,0);
if (extent != 0)
{
SetStringInfoLength(info,extent+1);
extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,"en",
"US",info,MagickMin(MagickPathExtent-1,extent));
if (*info != '\0')
(void) SetImageProperty((Image *) image,"icc:description",info);
"US",(char *) GetStringInfoDatum(info),extent);
if ((extent != 0) && (*GetStringInfoDatum(info) != '\0'))
(void) SetImageProperty((Image *) image,"icc:description",
(char *) GetStringInfoDatum(info));
}
extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer,"en","US",
NULL,0);
if (extent != 0)
if (extent != 0)
{
SetStringInfoLength(info,extent+1);
extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer,"en",
"US",info,MagickMin(MagickPathExtent-1,extent));
if (*info != '\0')
(void) SetImageProperty((Image *) image,"icc:manufacturer",info);
"US",(char *) GetStringInfoDatum(info),extent);
if ((extent != 0) && (*GetStringInfoDatum(info) != '\0'))
(void) SetImageProperty((Image *) image,"icc:manufacturer",
(char *) GetStringInfoDatum(info));
}
extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,"en","US",
NULL,0);
if (extent != 0)
{
SetStringInfoLength(info,extent+1);
extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,"en","US",
info,MagickMin(MagickPathExtent-1,extent));
if (*info != '\0')
(void) SetImageProperty((Image *) image,"icc:model",info);
(char *) GetStringInfoDatum(info),extent);
if ((extent != 0) && (*GetStringInfoDatum(info) != '\0'))
(void) SetImageProperty((Image *) image,"icc:model",
(char *) GetStringInfoDatum(info));
}
extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright,"en","US",
NULL,0);
if (extent != 0)
{
SetStringInfoLength(info,extent+1);
extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright,"en",
"US",info,MagickMin(MagickPathExtent-1,extent));
if (*info != '\0')
(void) SetImageProperty((Image *) image,"icc:copyright",info);
"US",(char *) GetStringInfoDatum(info),extent);
if ((extent != 0) && (*GetStringInfoDatum(info) != '\0'))
(void) SetImageProperty((Image *) image,"icc:copyright",
(char *) GetStringInfoDatum(info));
}
info=DestroyStringInfo(info);
#endif
(void) cmsCloseProfile(icc_profile);
}
Expand Down

0 comments on commit 2c452fc

Please sign in to comment.