From 7d2553e6f4849f937e3b32fcac096a23932a6f64 Mon Sep 17 00:00:00 2001 From: anthony Date: Fri, 11 May 2012 02:23:39 +0000 Subject: [PATCH] Added sanity checks to EWA resampling --- MagickCore/resample.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MagickCore/resample.c b/MagickCore/resample.c index 5d7af2f81..f30b4a61c 100644 --- a/MagickCore/resample.c +++ b/MagickCore/resample.c @@ -645,8 +645,9 @@ MagickExport MagickBooleanType ResamplePixelColor( /* Result sanity check -- this should NOT happen */ - if ( hit == 0 ) { - /* not enough pixels in resampling, resort to direct interpolation */ + if ( hit == 0 || divisor_m <= MagickEpsilon || divisor_c <= MagickEpsilon ) { + /* not enough pixels, or bad weighting in resampling, + resort to direct interpolation */ #if DEBUG_NO_PIXEL_HIT pixel->alpha = pixel->red = pixel->green = pixel->blue = 0; pixel->red = QuantumRange; /* show pixels for which EWA fails */ -- 2.50.1