From: Cristy Date: Sat, 2 Jun 2018 00:37:25 +0000 (-0400) Subject: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8682 X-Git-Tag: 7.0.7-38~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2254b1d5389718067e72fd130db652ee9e2fcb30;p=imagemagick https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8682 --- diff --git a/MagickCore/draw.c b/MagickCore/draw.c index 3e3267a12..1ed0b4001 100644 --- a/MagickCore/draw.c +++ b/MagickCore/draw.c @@ -2359,6 +2359,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, double angle, + coordinates, factor, primitive_extent; @@ -2368,9 +2369,6 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, MagickBooleanType proceed; - MagickSizeType - coordinates; - MagickStatusType status; @@ -3850,7 +3848,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, /* Speculate how many points our primitive might consume. */ - coordinates=primitive_info[j].coordinates; + coordinates=(double) primitive_info[j].coordinates; switch (primitive_type) { case RectanglePrimitive: @@ -3882,7 +3880,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, status=MagickFalse; break; } - coordinates=(BezierQuantum*primitive_info[j].coordinates); + coordinates=(double) (BezierQuantum*primitive_info[j].coordinates); break; } case PathPrimitive: @@ -3925,8 +3923,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, alpha=bounds.x2-bounds.x1; beta=bounds.y2-bounds.y1; radius=hypot(alpha,beta); - coordinates=(MagickSizeType) (2*(ceil(MagickPI*radius))+6* - BezierQuantum+360); + coordinates=2.0*(ceil(MagickPI*radius))+6*BezierQuantum+360.0; break; } default: @@ -3934,8 +3931,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, } if (coordinates > MaxBezierCoordinates) { - (void) ThrowMagickException(exception,GetMagickModule(),DrawError, - "TooManyBezierCoordinates","`%s'",token); + (void) ThrowMagickException(exception,GetMagickModule(), + ResourceLimitError,"MemoryAllocationFailed","`%s'",token); status=MagickFalse; } if (status == MagickFalse) @@ -4102,8 +4099,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, } case PathPrimitive: { - coordinates=TracePath(&mvg_info,token,exception); - if (coordinates == 0) + coordinates=(double) TracePath(&mvg_info,token,exception); + if (coordinates == 0.0) { status=MagickFalse; break;