From 3eb67c6227ff7d5dee46ba111183fc0b2808eb2a Mon Sep 17 00:00:00 2001 From: Cristy Date: Thu, 20 Jun 2024 20:38:40 -0400 Subject: [PATCH] fix boundary condition when resampling pixel color (https://github.com/ImageMagick/ImageMagick/issues/7415) --- MagickCore/resample.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MagickCore/resample.c b/MagickCore/resample.c index e8b50a4f43..e35c595ab0 100644 --- a/MagickCore/resample.c +++ b/MagickCore/resample.c @@ -598,11 +598,11 @@ MagickExport MagickBooleanType ResamplePixelColor( weight = 0.0; #if FILTER_LUT /* Note that the ellipse has been pre-scaled so F = WLUT_WIDTH */ - if ((Q >= 0.0) && ((int) Q < WLUT_WIDTH)) { - weight = resample_filter->filter_lut[(int)Q]; + if (((int) Q >= 0) && ((int) Q < WLUT_WIDTH)) { + weight = resample_filter->filter_lut[(int) Q]; #else /* Note that the ellipse has been pre-scaled so F = support^2 */ - if ((Q >= 0.0) && (Q < (double)resample_filter->F)) { + if ((Q >= 0.0) && (Q < resample_filter->F)) { weight = GetResizeFilterWeight(resample_filter->filter_def, sqrt(Q)); /* a SquareRoot! Arrggghhhhh... */ #endif