From 5facf779a72726450bd96eec4edf461163f5ed8c Mon Sep 17 00:00:00 2001 From: cristy Date: Sun, 26 Jan 2014 14:42:57 +0000 Subject: [PATCH] --- MagickCore/blob.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/MagickCore/blob.c b/MagickCore/blob.c index 464318520..e2120bf88 100644 --- a/MagickCore/blob.c +++ b/MagickCore/blob.c @@ -1534,8 +1534,9 @@ MagickExport unsigned char *ImageToBlob(const ImageInfo *image_info, /* 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 @@ MagickExport unsigned char *ImageToBlob(const ImageInfo *image_info, (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 @@ MagickExport unsigned char *ImagesToBlob(const ImageInfo *image_info, /* 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 @@ MagickExport unsigned char *ImagesToBlob(const ImageInfo *image_info, (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); -- 2.40.0