From b1e14ee95d68d1e10829ed09f49ca00658271602 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 30 Mar 2019 08:10:03 -0400 Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/1506 --- ChangeLog | 4 +++ MagickCore/draw.c | 62 +++++++++++++++++++++++++++++++++-------------- 2 files changed, 48 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index b8d165049..4f1435518 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2019-03-27 7.0.8-36 Cristy + * Fixed a number of issues (reference + https://github.com/ImageMagick/ImageMagick/issues). + 2019-03-24 7.0.8-35 Cristy * Release ImageMagick version 7.0.8-35, GIT revision 15440:4a0a88e41:20190324 diff --git a/MagickCore/draw.c b/MagickCore/draw.c index 8a5d5b858..e8cf327a1 100644 --- a/MagickCore/draw.c +++ b/MagickCore/draw.c @@ -2723,8 +2723,18 @@ static MagickBooleanType RenderMVGContent(Image *image, graphic_context[n]->clipping_mask=DrawClippingMask(image, graphic_context[n],token,clip_path,exception); if (draw_info->compliance != SVGCompliance) - status&=DrawClipPath(image,graphic_context[n], - graphic_context[n]->clip_mask,exception); + { + const char + *clip_path; + + clip_path=(const char *) GetValueFromSplayTree(macros, + graphic_context[n]->clip_mask); + if (clip_path != (const char *) NULL) + (void) SetImageArtifact(image, + graphic_context[n]->clip_mask,clip_path); + status&=DrawClipPath(image,graphic_context[n], + graphic_context[n]->clip_mask,exception); + } } break; } @@ -3238,17 +3248,23 @@ static MagickBooleanType RenderMVGContent(Image *image, } if (LocaleCompare("clip-path",token) == 0) { - char - name[MaxTextExtent]; - - const char - *clip_path; - GetNextToken(q,&q,extent,token); - (void) FormatLocaleString(name,MaxTextExtent,"%s",token); - clip_path=(const char *) GetValueFromSplayTree(macros,name); - if (clip_path != (const char *) NULL) - (void) SetImageArtifact(image,name,clip_path); + for (p=q; *q != '\0'; ) + { + GetNextToken(q,&q,extent,token); + if (LocaleCompare(token,"pop") != 0) + continue; + GetNextToken(q,(const char **) NULL,extent,token); + if (LocaleCompare(token,"clip-path") != 0) + continue; + break; + } + if ((q == (char *) NULL) || (p == (char *) NULL) || ((q-4) < p)) + { + status=MagickFalse; + break; + } + GetNextToken(q,&q,extent,token); break; } if (LocaleCompare("defs",token) == 0) @@ -4342,8 +4358,18 @@ static MagickBooleanType RenderMVGContent(Image *image, (graphic_context[n]->clip_mask != (char *) NULL) && (LocaleCompare(graphic_context[n]->clip_mask, graphic_context[n-1]->clip_mask) != 0)) - status&=DrawClipPath(image,graphic_context[n], - graphic_context[n]->clip_mask,exception); + { + const char + *clip_path; + + clip_path=(const char *) GetValueFromSplayTree(macros, + graphic_context[n]->clip_mask); + if (clip_path != (const char *) NULL) + (void) SetImageArtifact(image,graphic_context[n]->clip_mask, + clip_path); + status&=DrawClipPath(image,graphic_context[n], + graphic_context[n]->clip_mask,exception); + } status&=DrawPrimitive(image,graphic_context[n],primitive_info, exception); } @@ -4996,10 +5022,10 @@ RestoreMSCWarning static inline double ConstrainCoordinate(double x) { - if (x < -SSIZE_MAX) - return(-SSIZE_MAX); - if (x > SSIZE_MAX) - return(SSIZE_MAX); + if (x < (double) -SSIZE_MAX) + return((double) -SSIZE_MAX); + if (x > (double) SSIZE_MAX) + return((double) SSIZE_MAX); return(x); } -- 2.40.0