]> granicus.if.org Git - imagemagick/commitdiff
Eliminate Use-of-uninitialized-value in PerceptibleReciprocal
authorCristy <urban-warrior@imagemagick.org>
Thu, 25 Jan 2018 12:15:55 +0000 (07:15 -0500)
committerCristy <urban-warrior@imagemagick.org>
Thu, 25 Jan 2018 12:15:55 +0000 (07:15 -0500)
Credit OSS Fuzz

MagickCore/geometry.c

index 7cc3b06a51afcbe2896c044e5ba6455387643f0c..686ccb6df1bc926a4b38195fbf94d618b4d4fb5b 100644 (file)
@@ -869,6 +869,7 @@ MagickExport MagickStatusType ParseGeometry(const char *geometry,
     Remove whitespaces meta characters from geometry specification.
   */
   assert(geometry_info != (GeometryInfo *) NULL);
+  (void) ResetMagickMemory(geometry_info,0,sizeof(geometry_info));
   flags=NoValue;
   if ((geometry == (char *) NULL) || (*geometry == '\0'))
     return(flags);
@@ -1119,7 +1120,8 @@ MagickExport MagickStatusType ParseGeometry(const char *geometry,
       /*
         Normalize sampling factor (e.g. 4:2:2 => 2x1).
       */
-      geometry_info->rho*=PerceptibleReciprocal(geometry_info->sigma);
+      if ((flags & SigmaValue) != 0)
+        geometry_info->rho*=PerceptibleReciprocal(geometry_info->sigma);
       geometry_info->sigma=1.0;
       if (geometry_info->xi == 0.0)
         geometry_info->sigma=2.0;