Commit 7936d9c7b for imagemagick.org

commit 7936d9c7bec4bd459a8d4b5304a1a6fbf7dac0ea
Author: Dirk Lemstra <dirk@lemstra.org>
Date:   Mon Mar 2 20:32:25 2026 +0100

    Corrected the overflow check that can cause issues on 32-bit systems (GHSA-56jp-jfqg-f8f4)

diff --git a/coders/sfw.c b/coders/sfw.c
index cc5fcedc6..cca66ab05 100644
--- a/coders/sfw.c
+++ b/coders/sfw.c
@@ -250,12 +250,12 @@ static Image *ReadSFWImage(const ImageInfo *image_info,ExceptionInfo *exception)
   /*
     Read image into a buffer.
   */
-  if (GetBlobSize(image) != (size_t) GetBlobSize(image))
+  extent=(size_t) GetBlobSize(image)+MagickPathExtent;
+  if (GetBlobSize(image) != extent)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
   if (GetBlobSize(image) < 141)
     ThrowReaderException(CorruptImageError,"ImproperImageHeader");
-  buffer=(unsigned char *) AcquireQuantumMemory((size_t) GetBlobSize(image)+
-    MagickPathExtent,sizeof(*buffer));
+  buffer=(unsigned char *) AcquireQuantumMemory(extent,sizeof(*buffer));
   if (buffer == (unsigned char *) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
   count=ReadBlob(image,(size_t) GetBlobSize(image),buffer);