Commit 54fdd9556 for imagemagick.org
commit 54fdd95562e4ac1ea973be89156500b37fac2c2e
Author: Cristy <urban-warrior@imagemagick.org>
Date: Sat Sep 19 09:46:10 2026 -0400
https://github.com/ImageMagick/ImageMagick/issues/8968
diff --git a/MagickCore/blob.c b/MagickCore/blob.c
index 4a67b6a1e..78f6d9a0e 100644
--- a/MagickCore/blob.c
+++ b/MagickCore/blob.c
@@ -1541,6 +1541,12 @@ MagickExport void *FileToBlob(const char *filename,const size_t extent,
}
if (LocaleCompare(filename,"-") != 0)
file=close_utf8(file);
+ if (count < 0)
+ {
+ blob=(unsigned char *) RelinquishMagickMemory(blob);
+ ThrowFileException(exception,BlobError,"UnableToReadBlob",filename);
+ return(NULL);
+ }
if (blob == (unsigned char *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),