From: cristy Date: Sun, 3 May 2015 12:45:49 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~1069 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0779de249d9e7d883fe69f1a6737968f6e4390e5;p=imagemagick --- diff --git a/MagickCore/blob.c b/MagickCore/blob.c index 3abb8ba98..2c2d78693 100644 --- a/MagickCore/blob.c +++ b/MagickCore/blob.c @@ -125,6 +125,7 @@ struct _BlobInfo MagickBooleanType exempt, + immutable, synchronize, status, temporary; @@ -204,6 +205,7 @@ MagickExport void AttachBlob(BlobInfo *blob_info,const void *blob, blob_info->file_info.file=(FILE *) NULL; blob_info->data=(unsigned char *) blob; blob_info->mapped=MagickFalse; + blob_info->immutable=MagickTrue; } /* @@ -453,6 +455,7 @@ MagickExport BlobInfo *CloneBlobInfo(const BlobInfo *blob_info) clone_info->offset=blob_info->offset; clone_info->size=blob_info->size; clone_info->exempt=blob_info->exempt; + clone_info->immutable=blob_info->immutable; clone_info->status=blob_info->status; clone_info->temporary=blob_info->temporary; clone_info->type=blob_info->type; @@ -692,6 +695,7 @@ MagickExport void *DetachBlob(BlobInfo *blob_info) blob_info->offset=0; blob_info->eof=MagickFalse; blob_info->exempt=MagickFalse; + blob_info->immutable=MagickFalse; blob_info->type=UndefinedStream; blob_info->file_info.file=(FILE *) NULL; data=blob_info->data; @@ -3713,8 +3717,6 @@ MagickExport MagickOffsetType SeekBlob(Image *image, return(-1); case FileStream: { - if ((whence == SEEK_SET) && (offset < 0)) - return(-1); if (fseek(image->blob->file_info.file,offset,whence) < 0) return(-1); image->blob->offset=TellBlob(image); @@ -3767,11 +3769,14 @@ MagickExport MagickOffsetType SeekBlob(Image *image, image->blob->eof=MagickFalse; break; } - if (image->blob->mapped != MagickFalse) - return(-1); if (image->blob->offset < (MagickOffsetType) ((off_t) image->blob->extent)) break; + if (image->blob->immutable != MagickFalse) + { + image->blob->eof=MagickTrue; + return(-1); + } image->blob->extent=(size_t) (image->blob->offset+image->blob->quantum); image->blob->quantum<<=1; image->blob->data=(unsigned char *) ResizeQuantumMemory(image->blob->data,