Commit 84563777b for imagemagick.org
commit 84563777b5cf7bbda655f33f96cd91a931b1792a
Author: Cristy <urban-warrior@imagemagick.org>
Date: Fri Dec 4 11:05:09 2026 -0500
GetFuzzyColorDistance() now returns 0.0 for a NULL
diff --git a/MagickCore/color-private.h b/MagickCore/color-private.h
index 676fdd3f2..8ce7999da 100644
--- a/MagickCore/color-private.h
+++ b/MagickCore/color-private.h
@@ -18,8 +18,11 @@
#ifndef MAGICKCORE_COLOR_PRIVATE_H
#define MAGICKCORE_COLOR_PRIVATE_H
+#include "MagickCore/color.h"
+#include "MagickCore/exception.h"
#include "MagickCore/image.h"
#include "MagickCore/image-private.h"
+#include "MagickCore/string_.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
@@ -43,7 +46,8 @@ static inline MagickBooleanType GetColorRange(const char *color,
MagickBooleanType
status;
- if (color == (const char *) NULL)
+ if ((color == (const char *) NULL) || (start == (PixelInfo *) NULL) ||
+ (stop == (PixelInfo *) NULL))
return(MagickFalse);
if (*color != '\0')
{
@@ -71,8 +75,10 @@ static inline MagickBooleanType GetColorRange(const char *color,
static inline double GetFuzzyColorDistance(const Image *p,const Image *q)
{
/*
- Variance-style combined fuzz.
+ Variance-style combined fuzz: the squared fuzz of each image is summed.
*/
+ if (p == (const Image *) NULL)
+ return(0.0);
if (q == (const Image *) NULL)
return(p->fuzz*p->fuzz);
return(p->fuzz*p->fuzz+q->fuzz*q->fuzz);