]> granicus.if.org Git - imagemagick/commitdiff
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7402
authorCristy <urban-warrior@imagemagick.org>
Thu, 5 Apr 2018 23:08:48 +0000 (19:08 -0400)
committerCristy <urban-warrior@imagemagick.org>
Thu, 5 Apr 2018 23:18:10 +0000 (19:18 -0400)
MagickCore/draw.c

index a334e9b088eddcf47f8223252d24e7fc2eb5aa09..e0546c4522a00bbc59db5b2e5ae17ad054c2c661 100644 (file)
@@ -91,7 +91,6 @@
 */
 #define BezierQuantum  200
 #define DrawEpsilon  (1.0e-10)
-#define EllipseEpsilon  (0.0001)
 #define ThrowPointExpectedException(token,exception) \
 { \
   (void) ThrowMagickException(exception,GetMagickModule(),DrawError, \
@@ -1677,9 +1676,6 @@ static size_t GetEllipseCoordinates(const PointInfo start,const PointInfo stop,
   PointInfo
     angle;
 
-  size_t
-    coordinates;
-
   /*
     Ellipses are just short segmented polys.
   */
@@ -1687,16 +1683,12 @@ static size_t GetEllipseCoordinates(const PointInfo start,const PointInfo stop,
   step=MagickPI/8.0;
   if ((delta >= 0.0) && (delta < (MagickPI/8.0)))
     step=MagickPI/(4.0*(MagickPI*PerceptibleReciprocal(delta)/2.0));
-  if (step < EllipseEpsilon)
-    step=EllipseEpsilon;
   angle.x=DegreesToRadians(degrees.x);
   y=degrees.y;
   while (y < degrees.x)
     y+=360.0;
   angle.y=DegreesToRadians(y);
-  for (coordinates=0; angle.x < angle.y; angle.x+=step)
-    coordinates++;
-  return(coordinates+1);
+  return((size_t) floor((angle.y-angle.x)/step+0.5)+2);
 }
 
 static size_t GetRoundRectangleCoordinates(const PointInfo start,
@@ -5549,8 +5541,6 @@ static void TraceEllipse(PrimitiveInfo *primitive_info,const PointInfo start,
   step=MagickPI/8.0;
   if ((delta >= 0.0) && (delta < (MagickPI/8.0)))
     step=MagickPI/(4.0*(MagickPI*PerceptibleReciprocal(delta)/2.0));
-  if (step < EllipseEpsilon)
-    step=EllipseEpsilon;
   angle.x=DegreesToRadians(degrees.x);
   y=degrees.y;
   while (y < degrees.x)