Commit be351d3c7 for imagemagick.org
commit be351d3c72d558964b49bc226d819f397fe5ed93
Author: Cristy <urban-warrior@imagemagick.org>
Date: Mon May 4 22:12:21 2026 -0400
https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-v6qj-8rm4-fpgj
diff --git a/coders/sf3.c b/coders/sf3.c
index 037970cca..baf6bafaf 100644
--- a/coders/sf3.c
+++ b/coders/sf3.c
@@ -266,8 +266,10 @@ static Image *ReadSF3Image(const ImageInfo *image_info,ExceptionInfo *exception)
width=ReadBlobLSBLong(image);
height=ReadBlobLSBLong(image);
layers = ReadBlobLSBLong(image);
- if (width == 0 || height == 0 || layers == 0)
+ if ((width == 0) || (height == 0) || (layers == 0))
ThrowReaderException(CorruptImageError,"NegativeOrZeroImageSize");
+ if (AcquireMagickResource(ListLengthResource,layers) == MagickFalse)
+ ThrowReaderException(ResourceLimitError,"ListLengthExceedsLimit");
channels=(unsigned char) ReadBlobByte(image);
format=(unsigned char) ReadBlobByte(image);