]> granicus.if.org Git - imagemagick/commitdiff
Potential divide by zero
authorCristy <urban-warrior@imagemagick.org>
Tue, 22 Oct 2019 10:26:44 +0000 (06:26 -0400)
committerCristy <urban-warrior@imagemagick.org>
Tue, 22 Oct 2019 10:26:44 +0000 (06:26 -0400)
coders/svg.c

index 5faaab034d1b6a9d5f7ff22e60a7f2c0f7138950..2bc3c1f6b720057277686b414100ca83f100c759 100644 (file)
@@ -2527,8 +2527,8 @@ static void SVGStartElement(void *context,const xmlChar *name,
             svg_info->height=(size_t) floor(svg_info->bounds.height+0.5);
           (void) FormatLocaleFile(svg_info->file,"viewbox 0 0 %.20g %.20g\n",
             (double) svg_info->width,(double) svg_info->height);
-          sx=(double) svg_info->width/svg_info->view_box.width;
-          sy=(double) svg_info->height/svg_info->view_box.height;
+          sx=PerceptibleReciprocal(svg_info->view_box.width)*svg_info->width;
+          sy=PerceptibleReciprocal(svg_info->view_box.height)*svg_info->height;
           tx=svg_info->view_box.x != 0.0 ? (double) -sx*svg_info->view_box.x :
             0.0;
           ty=svg_info->view_box.y != 0.0 ? (double) -sy*svg_info->view_box.y :