Skip to content

Commit

Permalink
https://github.com/ImageMagick/ImageMagick/issues/1623
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Jul 1, 2019
1 parent 6a584be commit 4a334bb
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 15 deletions.
22 changes: 21 additions & 1 deletion MagickWand/mogrify.c
Original file line number Diff line number Diff line change
Expand Up @@ -7824,6 +7824,9 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
clut_image=RemoveFirstImageFromList(images);
if (clut_image == (Image *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError,"ImageSequenceRequired","`%s'",option);
image=DestroyImage(image);
status=MagickFalse;
break;
}
Expand Down Expand Up @@ -7896,6 +7899,9 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
reconstruct_image=RemoveFirstImageFromList(images);
if (reconstruct_image == (Image *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError,"ImageSequenceRequired","`%s'",option);
image=DestroyImage(image);
status=MagickFalse;
break;
}
Expand Down Expand Up @@ -7976,7 +7982,13 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
new_images=RemoveFirstImageFromList(images);
source_image=RemoveFirstImageFromList(images);
if (source_image == (Image *) NULL)
break; /* FUTURE - produce Exception, rather than silent fail */
{
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError,"ImageSequenceRequired","`%s'",option);
new_images=DestroyImage(new_images);
status=MagickFalse;
break;
}

/* FUTURE: this should not be here! - should be part of -geometry */
if (source_image->geometry != (char *) NULL)
Expand Down Expand Up @@ -8228,6 +8240,9 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
hald_image=RemoveFirstImageFromList(images);
if (hald_image == (Image *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError,"ImageSequenceRequired","`%s'",option);
image=DestroyImage(image);
status=MagickFalse;
break;
}
Expand Down Expand Up @@ -8257,11 +8272,16 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
phase_image=RemoveFirstImageFromList(images);
if (phase_image == (Image *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError,"ImageSequenceRequired","`%s'",option);
magnitude_image=DestroyImage(magnitude_image);
status=MagickFalse;
break;
}
fourier_image=InverseFourierTransformImage(magnitude_image,
phase_image,*option == '-' ? MagickTrue : MagickFalse,exception);
magnitude_image=DestroyImage(magnitude_image);
phase_image=DestroyImage(phase_image);
if (fourier_image == (Image *) NULL)
break;
if (*images != (Image *) NULL)
Expand Down
54 changes: 40 additions & 14 deletions MagickWand/operation.c
Original file line number Diff line number Diff line change
Expand Up @@ -3821,10 +3821,16 @@ WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand,
_images.
*/
new_images=RemoveFirstImageFromList(&_images);
clut_image=RemoveLastImageFromList(&_images);
clut_image=RemoveFirstImageFromList(&_images);
/* FUTURE - produce Exception, rather than silent fail */
if (clut_image == (Image *) NULL)
break;
{
(void) ThrowMagickException(_exception,GetMagickModule(),
OptionError,"ImageSequenceRequired","`%s'",option);
new_images=DestroyImage(new_images);
status=MagickFalse;
break;
}
(void) ClutImage(new_images,clut_image,new_images->interpolate,
_exception);
clut_image=DestroyImage(clut_image);
Expand Down Expand Up @@ -3868,8 +3874,11 @@ WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand,
reconstruct_image=RemoveFirstImageFromList(&_images);
/* FUTURE - produce Exception, rather than silent fail */
if (reconstruct_image == (Image *) NULL)
{
{
(void) ThrowMagickException(_exception,GetMagickModule(),
OptionError,"ImageSequenceRequired","`%s'",option);
image=DestroyImage(image);
status=MagickFalse;
break;
}
metric=UndefinedErrorMetric;
Expand Down Expand Up @@ -3931,7 +3940,13 @@ WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand,
new_images=RemoveFirstImageFromList(&_images);
source_image=RemoveFirstImageFromList(&_images);
if (source_image == (Image *) NULL)
break; /* FUTURE - produce Exception, rather than silent fail */
{
(void) ThrowMagickException(_exception,GetMagickModule(),
OptionError,"ImageSequenceRequired","`%s'",option);
new_images=DestroyImage(new_images);
status=MagickFalse;
break;
}

/* FUTURE - this should not be here! - should be part of -geometry */
if (source_image->geometry != (char *) NULL)
Expand Down Expand Up @@ -4121,7 +4136,13 @@ WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand,
new_images=RemoveFirstImageFromList(&_images);
hald_image=RemoveLastImageFromList(&_images);
if (hald_image == (Image *) NULL)
break;
{
(void) ThrowMagickException(_exception,GetMagickModule(),
OptionError,"ImageSequenceRequired","`%s'",option);
new_images=DestroyImage(new_images);
status=MagickFalse;
break;
}
(void) HaldClutImage(new_images,hald_image,_exception);
hald_image=DestroyImage(hald_image);
break;
Expand All @@ -4136,15 +4157,20 @@ WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand,
*magnitude_image,
*phase_image;

magnitude_image=RemoveFirstImageFromList(&_images);
phase_image=RemoveFirstImageFromList(&_images);
/* FUTURE - produce Exception, rather than silent fail */
if (phase_image == (Image *) NULL)
break;
new_images=InverseFourierTransformImage(magnitude_image,phase_image,
IsNormalOp,_exception);
magnitude_image=DestroyImage(magnitude_image);
phase_image=DestroyImage(phase_image);
magnitude_image=RemoveFirstImageFromList(&_images);
phase_image=RemoveFirstImageFromList(&_images);
if (phase_image == (Image *) NULL)
{
(void) ThrowMagickException(_exception,GetMagickModule(),
OptionError,"ImageSequenceRequired","`%s'",option);
magnitude_image=DestroyImage(magnitude_image);
status=MagickFalse;
break;
}
new_images=InverseFourierTransformImage(magnitude_image,phase_image,
IsNormalOp,_exception);
magnitude_image=DestroyImage(magnitude_image);
phase_image=DestroyImage(phase_image);
break;
}
if (LocaleCompare("insert",option+1) == 0)
Expand Down

0 comments on commit 4a334bb

Please sign in to comment.