From: Cristy Date: Tue, 23 Jan 2018 14:32:36 +0000 (-0500) Subject: Eliminate divide-by-zero in DDS coder X-Git-Tag: 7.0.7-23~297 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0dd6e892ccf0e3b81ecb2b5fca53e72b4a8095a7;p=imagemagick Eliminate divide-by-zero in DDS coder Credit OZZ Fuzz --- diff --git a/coders/dds.c b/coders/dds.c index 85e33a591..b82e5f119 100644 --- a/coders/dds.c +++ b/coders/dds.c @@ -1427,7 +1427,7 @@ static void ComputePrincipleComponent(const float *covariance, w.z = (row2.z * v.z) + w.z; w.w = (row2.w * v.z) + w.w; - a = 1.0f / MagickMax(w.x,MagickMax(w.y,w.z)); + a = (float) PerceptibleReciprocal(MagickMax(w.x,MagickMax(w.y,w.z))); v.x = w.x * a; v.y = w.y * a; @@ -1827,6 +1827,7 @@ static Image *ReadDDSImage(const ImageInfo *image_info,ExceptionInfo *exception) status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); + (void) SetImageBackgroundColor(image,exception); status=(decoder)(image_info,image,&dds_info,read_mipmaps,exception); if (status == MagickFalse) {