Commit 998773fa3 for imagemagick.org

commit 998773fa3d60f5c8a7964a73850904edf441b9fc
Author: Dirk Lemstra <dirk@lemstra.org>
Date:   Sat Oct 31 12:34:06 2026 +0100

    Also create a StrictReadInlineImage implementation (GHSA-h9f8-qmvx-p39m)

diff --git a/MagickCore/constitute-private.h b/MagickCore/constitute-private.h
index 30e501da9..cdfb228f5 100644
--- a/MagickCore/constitute-private.h
+++ b/MagickCore/constitute-private.h
@@ -32,21 +32,29 @@ extern "C" {
 extern MagickExport Image
   *ReadImageWithoutPostProcessing(const ImageInfo *,ExceptionInfo *);

-static inline Image *StrictReadImage(ImageInfo *image_info,
+static inline MagickBooleanType CheckCoderDepth(ImageInfo *image_info,
   ExceptionInfo *exception)
 {
 #define MagickMaxCoderDepth  250

-  char
-    magic[MagickPathExtent];
-
   if (image_info->coder_depth++ >= MagickMaxCoderDepth)
     {
       errno=EPERM;
       (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
         "ImageNestedTooDeeply","`%s'",image_info->filename);
-      return((Image *) NULL);
+      return(MagickFalse);
     }
+  return(MagickTrue);
+}
+
+static inline Image *StrictReadImage(ImageInfo *image_info,
+  ExceptionInfo *exception)
+{
+  char
+    magic[MagickPathExtent];
+
+  if (CheckCoderDepth(image_info,exception) == MagickFalse)
+    return((Image *) NULL);
   (void) GetPathComponent(image_info->filename,MagickPath,magic);
   if (*magic != '\0')
     {
@@ -70,6 +78,14 @@ static inline Image *StrictReadImage(ImageInfo *image_info,
   return(ReadImage(image_info,exception));
 }

+static inline Image *StrictReadInlineImage(ImageInfo *image_info,
+  const char *content,ExceptionInfo *exception)
+{
+  if (CheckCoderDepth(image_info,exception) == MagickFalse)
+    return((Image *) NULL);
+  return(ReadInlineImage(image_info,content,exception));
+}
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif
diff --git a/coders/svg.c b/coders/svg.c
index cca62b7ac..c37827190 100644
--- a/coders/svg.c
+++ b/coders/svg.c
@@ -2733,7 +2733,8 @@ static void SVGEndElement(void *context,const xmlChar *name)
             MagickPathExtent);
           image_info->coder_depth=svg_info->image_info->coder_depth;
           if (LocaleNCompare(image_info->filename,"data:",5) == 0)
-            image=ReadInlineImage(image_info,svg_info->url,svg_info->exception);
+            image=StrictReadInlineImage(image_info,svg_info->url,
+              svg_info->exception);
           else
             image=StrictReadImage(image_info,svg_info->exception);
           svg_info->image_info->coder_depth=image_info->coder_depth;