diff --git a/MagickCore/blob.c b/MagickCore/blob.c
index 4643185..e2120bf 100644
--- a/MagickCore/blob.c
+++ b/MagickCore/blob.c
@@ -1534,8 +1534,9 @@
/*
Native blob support for this image format.
*/
- blob_info->blob=(void *) AcquireQuantumMemory(image->columns,
- image->rows*sizeof(unsigned char));
+ blob_info->length=0;
+ blob_info->blob=(void *) AcquireQuantumMemory(MagickMaxBlobExtent,
+ sizeof(unsigned char));
if (blob_info->blob == (void *) NULL)
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
@@ -1544,9 +1545,8 @@
(void) CloseBlob(image);
image->blob->exempt=MagickTrue;
*image->filename='\0';
- blob_info->length=image->columns*image->rows;
status=WriteImage(blob_info,image,exception);
- *length=image->blob->offset;
+ *length=image->blob->length;
blob=DetachBlob(image->blob);
if (status == MagickFalse)
blob=(unsigned char *) RelinquishMagickMemory(blob);
@@ -1788,8 +1788,9 @@
/*
Native blob support for this images format.
*/
- blob_info->blob=(void *) AcquireQuantumMemory(images->columns,
- images->rows*sizeof(unsigned char));
+ blob_info->length=0;
+ blob_info->blob=(void *) AcquireQuantumMemory(MagickMaxBlobExtent,
+ sizeof(unsigned char));
if (blob_info->blob == (void *) NULL)
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",images->filename);
@@ -1798,9 +1799,8 @@
(void) CloseBlob(images);
images->blob->exempt=MagickTrue;
*images->filename='\0';
- blob_info->length=images->columns*images->rows;
status=WriteImages(blob_info,images,images->filename,exception);
- *length=images->blob->offset;
+ *length=images->blob->length;
blob=DetachBlob(images->blob);
if (status == MagickFalse)
blob=(unsigned char *) RelinquishMagickMemory(blob);