diff options
Diffstat (limited to 'magick/transform.c')
-rw-r--r-- | magick/transform.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/magick/transform.c b/magick/transform.c index 26fa921..88d3f58 100644 --- a/magick/transform.c +++ b/magick/transform.c @@ -1,5 +1,5 @@ /* -% Copyright (C) 2003 - 2021 GraphicsMagick Group +% Copyright (C) 2003 - 2022 GraphicsMagick Group % Copyright (C) 2002 ImageMagick Studio % Copyright 1991-1999 E. I. du Pont de Nemours and Company % @@ -130,6 +130,10 @@ MagickExport Image *ChopImage(const Image *image,const RectangleInfo *chop_info, clone_info.height-=(unsigned long) (-clone_info.y); clone_info.y=0; } + if ((clone_info.width >= image->columns) || + (clone_info.height >= image->rows)) + ThrowImageException3(OptionError,GeometryDoesNotContainImage, + UnableToChopImage); /* Initialize chop image attributes. */ @@ -497,6 +501,9 @@ MagickExport Image *CropImage(const Image *image,const RectangleInfo *geometry, MagickPassFail status=MagickPass; + MagickBool + transform_logging; + /* Check crop geometry. */ @@ -505,7 +512,8 @@ MagickExport Image *CropImage(const Image *image,const RectangleInfo *geometry, assert(geometry != (const RectangleInfo *) NULL); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); - if (image->logging) + transform_logging=IsEventLogged(TransformEvent); + if (transform_logging) (void) LogMagickEvent(TransformEvent,GetMagickModule(), "Crop Geometry: %lux%lu%+ld%+ld", geometry->width, geometry->height, @@ -551,7 +559,7 @@ MagickExport Image *CropImage(const Image *image,const RectangleInfo *geometry, page.y-=geometry->y; if (page.y < 0) page.y=0; - if (image->logging) + if (transform_logging) (void) LogMagickEvent(TransformEvent,GetMagickModule(), "Bounding Page: %lux%lu%+ld%+ld", page.width, page.height, page.x, page.y); @@ -1674,8 +1682,13 @@ MagickExport MagickPassFail TransformImage(Image **image,const char *crop_geomet MagickPassFail status = MagickPass; + MagickBool + transform_logging; + assert(image != (Image **) NULL); assert((*image)->signature == MagickSignature); + + transform_logging=IsEventLogged(TransformEvent); transform_image=(*image); if (crop_geometry != (const char *) NULL) { @@ -1687,7 +1700,7 @@ MagickExport MagickPassFail TransformImage(Image **image,const char *crop_geomet */ crop_image=(Image *) NULL; flags=GetImageGeometry(transform_image,crop_geometry,False,&geometry); - if (transform_image->logging) + if (transform_logging) (void) LogMagickEvent(TransformEvent,GetMagickModule(), "Crop Geometry: %lux%lu%+ld%+ld", geometry.width, geometry.height, @@ -1770,7 +1783,7 @@ MagickExport MagickPassFail TransformImage(Image **image,const char *crop_geomet SetGeometry(transform_image,&geometry); flags=GetMagickGeometry(image_geometry,&geometry.x,&geometry.y, &geometry.width,&geometry.height); - if (transform_image->logging) + if (transform_logging) (void) LogMagickEvent(TransformEvent,GetMagickModule(), "Transform Geometry: %lux%lu%+ld%+ld", geometry.width, geometry.height, |