Skip to content

Commit

Permalink
recursion detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Mar 5, 2023
1 parent 9f0cd40 commit 75b9ede
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
8 changes: 6 additions & 2 deletions coders/clip.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ ModuleExport void UnregisterCLIPImage(void)
static MagickBooleanType WriteCLIPImage(const ImageInfo *image_info,
Image *image)
{
const MagickInfo
*magick_info;

Image
*clip_image;

Expand All @@ -238,8 +241,9 @@ static MagickBooleanType WriteCLIPImage(const ImageInfo *image_info,
write_info=CloneImageInfo(image_info);
*write_info->magick='\0';
(void) SetImageInfo(write_info,1,&image->exception);
if ((*write_info->magick == '\0') ||
(LocaleCompare(write_info->magick,"CLIP") == 0))
magick_info=GetMagickInfo(write_info->magick,&image->exception);
if ((magick_info == (const MagickInfo*) NULL) ||
(LocaleCompare(magick_info->module,"CLIP") == 0))
(void) FormatLocaleString(clip_image->filename,MaxTextExtent,"miff:%s",
write_info->filename);
status=WriteImage(write_info,clip_image);
Expand Down
8 changes: 6 additions & 2 deletions coders/histogram.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ static MagickBooleanType WriteHISTOGRAMImage(const ImageInfo *image_info,
const char
*option;

const MagickInfo
*magick_info;

ExceptionInfo
*exception;

Expand Down Expand Up @@ -386,8 +389,9 @@ static MagickBooleanType WriteHISTOGRAMImage(const ImageInfo *image_info,
write_info=CloneImageInfo(image_info);
*write_info->magick='\0';
(void) SetImageInfo(write_info,1,&image->exception);
if ((*write_info->magick == '\0') ||
(LocaleCompare(write_info->magick,"HISTOGRAM") == 0))
magick_info=GetMagickInfo(write_info->magick,&image->exception);
if ((magick_info == (const MagickInfo*) NULL) ||
(LocaleCompare(magick_info->module,"HISTOGRAM") == 0))
(void) FormatLocaleString(histogram_image->filename,MaxTextExtent,
"miff:%s",write_info->filename);
status=WriteImage(write_info,histogram_image);
Expand Down
8 changes: 6 additions & 2 deletions coders/thumbnail.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ static MagickBooleanType WriteTHUMBNAILImage(const ImageInfo *image_info,
const char
*property;

const MagickInfo
*magick_info;

const StringInfo
*profile;

Expand Down Expand Up @@ -211,8 +214,9 @@ static MagickBooleanType WriteTHUMBNAILImage(const ImageInfo *image_info,
write_info=CloneImageInfo(image_info);
(void) SetImageInfo(write_info,1,&image->exception);
*write_info->magick='\0';
if ((*write_info->magick == '\0') ||
(LocaleCompare(write_info->magick,"THUMBNAIL") == 0))
magick_info=GetMagickInfo(write_info->magick,&image->exception);
if ((magick_info == (const MagickInfo*) NULL) ||
(LocaleCompare(magick_info->module,"THUMBNAIL") == 0))
(void) FormatLocaleString(thumbnail_image->filename,MaxTextExtent,
"miff:%s",write_info->filename);
status=WriteImage(write_info,thumbnail_image);
Expand Down
8 changes: 6 additions & 2 deletions coders/vid.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ ModuleExport void UnregisterVIDImage(void)
*/
static MagickBooleanType WriteVIDImage(const ImageInfo *image_info,Image *image)
{
const MagickInfo
*magick_info;

Image
*montage_image;

Expand Down Expand Up @@ -355,8 +358,9 @@ static MagickBooleanType WriteVIDImage(const ImageInfo *image_info,Image *image)
write_info=CloneImageInfo(image_info);
*write_info->magick='\0';
(void) SetImageInfo(write_info,1,&image->exception);
if ((*write_info->magick == '\0') ||
(LocaleCompare(write_info->magick,"VID") == 0))
magick_info=GetMagickInfo(write_info->magick,&image->exception);
if ((magick_info == (const MagickInfo*) NULL) ||
(LocaleCompare(magick_info->module,"VID") == 0))
(void) FormatLocaleString(montage_image->filename,MaxTextExtent,
"miff:%s",write_info->filename);
status=WriteImage(write_info,montage_image);
Expand Down

0 comments on commit 75b9ede

Please sign in to comment.