From: Cristy Date: Sun, 28 Aug 2016 13:24:43 +0000 (-0400) Subject: Prevent runtime error: division by zero X-Git-Tag: 7.0.3-0~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1ccd189606c8fdae50ab0e2e6a16965ec5528c26;p=imagemagick Prevent runtime error: division by zero --- diff --git a/MagickCore/statistic.c b/MagickCore/statistic.c index c40559fde..99e982188 100644 --- a/MagickCore/statistic.c +++ b/MagickCore/statistic.c @@ -2162,8 +2162,9 @@ MagickExport ChannelStatistics *GetImageStatistics(const Image *image, count; count=histogram[GetPixelChannels(image)*j+i]*area; - channel_statistics[i].entropy+=-count*MagickLog10(count)/ - MagickLog10(number_bins); + if (number_bins > MagickEpsilon) + channel_statistics[i].entropy+=-count*MagickLog10(count)/ + MagickLog10(number_bins); } } for (i=0; i < (ssize_t) MaxPixelChannels; i++)