Commit 322a3aa4e for imagemagick.org
commit 322a3aa4ed79deadfaeb75f646564721cbfa49a0
Author: Dirk Lemstra <dirk@lemstra.org>
Date: Wed Nov 25 12:34:03 2026 +0100
Added check for allocated memory.
diff --git a/coders/svg.c b/coders/svg.c
index 3c6424ee8..aeddbfbcb 100644
--- a/coders/svg.c
+++ b/coders/svg.c
@@ -4047,6 +4047,13 @@ static MagickBooleanType TraceSVGImage(Image *image,ExceptionInfo *exception)
encode_length=0;
base64=Base64Encode(blob,blob_length,&encode_length);
blob=(unsigned char *) RelinquishMagickMemory(blob);
+ if (base64 == (char *) NULL)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),
+ ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
+ (void) CloseBlob(image);
+ return(MagickFalse);
+ }
(void) FormatLocaleString(message,MagickPathExtent,
" <image id=\"image%.17g\" width=\"%.17g\" height=\"%.17g\" "
"x=\"%.17g\" y=\"%.17g\"\n xlink:href=\"data:image/png;base64,",