Commit 68ec7c8a9 for imagemagick.org

commit 68ec7c8a93042f902c9b1861307c9472023cb570
Author: Cristy <urban-warrior@imagemagick.org>
Date:   Fri Dec 4 18:42:50 2026 -0500

    ReadINLINEImage now clears errno before each ReadBlob()

diff --git a/coders/inline.c b/coders/inline.c
index 4dc92667b..308106c4c 100644
--- a/coders/inline.c
+++ b/coders/inline.c
@@ -169,6 +169,7 @@ static Image *ReadINLINEImage(const ImageInfo *image_info,
   count=0;
   for (i=0; inline_image != (unsigned char *) NULL; i+=count)
   {
+    errno=0;  /* a stale EINTR must not turn EOF into an endless retry loop */
     count=(ssize_t) ReadBlob(image,quantum,inline_image+i);
     if (count <= 0)
       {
@@ -188,8 +189,11 @@ static Image *ReadINLINEImage(const ImageInfo *image_info,
     {
       (void) ThrowMagickException(exception,GetMagickModule(),
         ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
+      (void) CloseBlob(image);
+      image=DestroyImageList(image);
       return((Image *) NULL);
     }
+  (void) CloseBlob(image);
   inline_image[i+count]='\0';
   image=DestroyImageList(image);
   image=ReadInlineImage(image_info,(char *) inline_image,exception);
@@ -352,14 +356,17 @@ static MagickBooleanType WriteINLINEImage(const ImageInfo *image_info,
     {
       write_info=DestroyImageInfo(write_info);
       (void) CloseBlob(image);
-      return(MagickTrue);
+      return(MagickFalse);
     }
   blob=(unsigned char *) ImageToBlob(write_info,write_image,&blob_length,
     exception);
   write_image=DestroyImage(write_image);
   write_info=DestroyImageInfo(write_info);
   if (blob == (unsigned char *) NULL)
-    return(MagickFalse);
+    {
+      (void) CloseBlob(image);
+      return(MagickFalse);
+    }
   encode_length=0;
   base64=Base64Encode(blob,blob_length,&encode_length);
   blob=(unsigned char *) RelinquishMagickMemory(blob);
@@ -370,8 +377,10 @@ static MagickBooleanType WriteINLINEImage(const ImageInfo *image_info,
   */
   (void) FormatLocaleString(message,MagickPathExtent,"data:%s;base64,",
     GetMagickMimeType(magick_info));
-  (void) WriteBlobString(image,message);
-  (void) WriteBlobString(image,base64);
+  if (WriteBlobString(image,message) != (ssize_t) strlen(message))
+    status=MagickFalse;
+  if (WriteBlobString(image,base64) != (ssize_t) encode_length)
+    status=MagickFalse;
   base64=DestroyString(base64);
   if (CloseBlob(image) == MagickFalse)
     status=MagickFalse;