Skip to content

Commit

Permalink
check to see if ICC property exists before its created
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Apr 1, 2022
1 parent cbbcfa1 commit a5263ab
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions magick/property.c
Original file line number Diff line number Diff line change
Expand Up @@ -1677,20 +1677,31 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
return(status);
}

static MagickBooleanType GetICCProperty(const Image *image,const char *property)
static const char *GetICCProperty(const Image *image,const char *key)
{
const char
*value;

const StringInfo
*profile;

magick_unreferenced(property);

/*
Return ICC profile property.
*/
if (image->properties != (void *) NULL)
{
value=(const char *) GetValueFromSplayTree((SplayTreeInfo *)
image->properties,key);
if (value != (const char *) NULL)
return(value);
}
profile=GetImageProfile(image,"icc");
if (profile == (StringInfo *) NULL)
profile=GetImageProfile(image,"icm");
if (profile == (StringInfo *) NULL)
return(MagickFalse);
return((const char *) NULL);
if (GetStringInfoLength(profile) < 128)
return(MagickFalse); /* minimum ICC profile length */
return((const char *) NULL); /* minimum ICC profile length */
#if defined(MAGICKCORE_LCMS_DELEGATE)
{
cmsHPROFILE
Expand Down Expand Up @@ -1765,7 +1776,14 @@ static MagickBooleanType GetICCProperty(const Image *image,const char *property)
}
}
#endif
return(MagickTrue);
if (image->properties != (void *) NULL)
{
value=(const char *) GetValueFromSplayTree((SplayTreeInfo *)
image->properties,key);
if (value != (const char *) NULL)
return(value);
}
return((const char *) NULL);
}

static MagickBooleanType SkipXMPValue(const char *value)
Expand Down

0 comments on commit a5263ab

Please sign in to comment.