]> granicus.if.org Git - imagemagick/commitdiff
Added sanity checks to EWA resampling
authoranthony <anthony@git.imagemagick.org>
Fri, 11 May 2012 02:23:39 +0000 (02:23 +0000)
committeranthony <anthony@git.imagemagick.org>
Fri, 11 May 2012 02:23:39 +0000 (02:23 +0000)
MagickCore/resample.c

index 5d7af2f819a004a70dbfe37998708b30b5535fee..f30b4a61c2bb2fe9d3b6c25de1749ea862ed383e 100644 (file)
@@ -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 */