From: Cristy Date: Mon, 1 Jul 2019 23:53:59 +0000 (-0400) Subject: https://github.com/ImageMagick/ImageMagick/issues/1623 X-Git-Tag: 7.0.8-52~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4a334bbf5584de37c6f5a47c380a531c8c4b140a;p=imagemagick https://github.com/ImageMagick/ImageMagick/issues/1623 --- diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c index 150b67923..9f7eb6b55 100644 --- a/MagickWand/mogrify.c +++ b/MagickWand/mogrify.c @@ -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; } @@ -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; } @@ -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) @@ -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; } @@ -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) diff --git a/MagickWand/operation.c b/MagickWand/operation.c index b87457434..57a29ac91 100644 --- a/MagickWand/operation.c +++ b/MagickWand/operation.c @@ -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); @@ -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; @@ -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) @@ -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; @@ -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)