]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Thu, 3 May 2018 17:33:54 +0000 (13:33 -0400)
committerCristy <urban-warrior@imagemagick.org>
Thu, 3 May 2018 17:33:54 +0000 (13:33 -0400)
MagickCore/draw.c

index 5c4f61df3e4e6bf5d6e652748d18cb5c265a1ab3..51ee7e6758a4c171d5ee9e9c6a0fc87b6273165a 100644 (file)
@@ -6494,17 +6494,17 @@ static void TraceSquareLinecap(PrimitiveInfo *primitive_info,
 static PrimitiveInfo *TraceStrokePolygon(const Image *image,
   const DrawInfo *draw_info,const PrimitiveInfo *primitive_info)
 {
-#define CheckPathExtent(extent) \
-  if (q >= (ssize_t) (max_strokes-(extent)-6*BezierQuantum-360)) \
+#define CheckPathExtent(pad) \
+  if ((q+(pad)) >= (ssize_t) max_strokes) \
     { \
-      if (~max_strokes < (extent+6*BezierQuantum+360)) \
+      if (~max_strokes < (pad)) \
         { \
           path_p=(PointInfo *) RelinquishMagickMemory(path_p); \
           path_q=(PointInfo *) RelinquishMagickMemory(path_q); \
         } \
       else \
         { \
-          max_strokes+=extent+6*BezierQuantum+360; \
+          max_strokes+=(pad); \
           path_p=(PointInfo *) ResizeQuantumMemory(path_p,max_strokes, \
             sizeof(*path_p)); \
           path_q=(PointInfo *) ResizeQuantumMemory(path_q,max_strokes, \
@@ -6764,7 +6764,7 @@ static PrimitiveInfo *TraceStrokePolygon(const Image *image,
           box_q[3].y)/(slope.p-slope.q));
         box_q[4].y=(double) (slope.p*(box_q[4].x-box_q[0].x)+box_q[0].y);
       }
-    CheckPathExtent(0);
+    CheckPathExtent(6*BezierQuantum-360);
     dot_product=dx.q*dy.p-dx.p*dy.q;
     if (dot_product <= 0.0)
       switch (draw_info->linejoin)
@@ -6820,7 +6820,7 @@ static PrimitiveInfo *TraceStrokePolygon(const Image *image,
             theta.q+=2.0*MagickPI;
           arc_segments=(size_t) ceil((double) ((theta.q-theta.p)/
             (2.0*sqrt((double) (1.0/mid)))));
-          CheckPathExtent(arc_segments);
+          CheckPathExtent(arc_segments+6*BezierQuantum-360);
           path_q[q].x=box_q[1].x;
           path_q[q].y=box_q[1].y;
           q++;
@@ -6893,7 +6893,7 @@ static PrimitiveInfo *TraceStrokePolygon(const Image *image,
             theta.p+=2.0*MagickPI;
           arc_segments=(size_t) ceil((double) ((theta.p-theta.q)/
             (2.0*sqrt((double) (1.0/mid)))));
-          CheckPathExtent(arc_segments);
+          CheckPathExtent(arc_segments+6*BezierQuantum-360);
           path_p[p++]=box_p[1];
           for (j=1; j < (ssize_t) arc_segments; j++)
           {