From 80c52893cf6266a3ef9127c7ecf9e91b51bfea6a Mon Sep 17 00:00:00 2001 From: Cristy Date: Thu, 3 May 2018 20:06:56 -0400 Subject: [PATCH] ... --- MagickCore/draw.c | 4 ++-- coders/svg.c | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/MagickCore/draw.c b/MagickCore/draw.c index c93612f5e..c06fa95e6 100644 --- a/MagickCore/draw.c +++ b/MagickCore/draw.c @@ -6583,8 +6583,8 @@ static PrimitiveInfo *TraceStrokePolygon(const Image *image, number_vertices+2UL,sizeof(*polygon_primitive)); if (polygon_primitive == (PrimitiveInfo *) NULL) return((PrimitiveInfo *) NULL); - (void) memcpy(polygon_primitive,primitive_info,(size_t) - number_vertices*sizeof(*polygon_primitive)); + (void) memcpy(polygon_primitive,primitive_info,(size_t) number_vertices* + sizeof(*polygon_primitive)); closed_path=primitive_info[0].closed_subpath; if (((draw_info->linejoin == RoundJoin) || (draw_info->linejoin == MiterJoin)) && (closed_path != MagickFalse)) diff --git a/coders/svg.c b/coders/svg.c index 6e624cd02..8ef0cdb9b 100644 --- a/coders/svg.c +++ b/coders/svg.c @@ -184,6 +184,9 @@ typedef struct _SVGInfo xmlDocPtr document; #endif + + ssize_t + svgDepth; } SVGInfo; /* @@ -1143,6 +1146,7 @@ static void SVGStartElement(void *context,const xmlChar *name, } if (LocaleCompare((const char *) name,"svg") == 0) { + svg_info->svgDepth++; PushGraphicContext(id); (void) FormatLocaleFile(svg_info->file,"compliance \"SVG\"\n"); (void) FormatLocaleFile(svg_info->file,"fill \"black\"\n"); @@ -2309,7 +2313,7 @@ static void SVGStartElement(void *context,const xmlChar *name, 0.0; (void) FormatLocaleFile(svg_info->file,"affine %g 0 0 %g %g %g\n", sx,sy,tx,ty); - if (*background != '\0') + if ((svg_info->svgDepth == 1) && (*background != '\0')) { PushGraphicContext(id); (void) FormatLocaleFile(svg_info->file,"fill %s\n",background); @@ -2556,6 +2560,7 @@ static void SVGEndElement(void *context,const xmlChar *name) if (LocaleCompare((const char *) name,"svg") == 0) { (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n"); + svg_info->svgDepth--; break; } break; @@ -3339,6 +3344,7 @@ static Image *ReadSVGImage(const ImageInfo *image_info,ExceptionInfo *exception) svg_info->image_info=image_info; svg_info->bounds.width=image->columns; svg_info->bounds.height=image->rows; + svg_info->svgDepth=0; if (image_info->size != (char *) NULL) (void) CloneString(&svg_info->size,image_info->size); if (image->debug != MagickFalse) -- 2.50.1