From 0dd6e892ccf0e3b81ecb2b5fca53e72b4a8095a7 Mon Sep 17 00:00:00 2001 From: Cristy Date: Tue, 23 Jan 2018 09:32:36 -0500 Subject: [PATCH] Eliminate divide-by-zero in DDS coder Credit OZZ Fuzz --- coders/dds.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) { -- 2.40.0