From: Cristy Date: Thu, 3 May 2018 17:33:54 +0000 (-0400) Subject: ... X-Git-Tag: 7.0.7-31~28 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a87074e76ad6af63f008328310a3c1ca0189f24b;p=imagemagick ... --- diff --git a/MagickCore/draw.c b/MagickCore/draw.c index 5c4f61df3..51ee7e675 100644 --- a/MagickCore/draw.c +++ b/MagickCore/draw.c @@ -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++) {