]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sun, 3 May 2015 12:45:49 +0000 (12:45 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sun, 3 May 2015 12:45:49 +0000 (12:45 +0000)
MagickCore/blob.c

index 3abb8ba9859e116735952dd40a9ac46924b5d1ed..2c2d78693ecf02f651d2d83cd5b7cdc6bf0274d2 100644 (file)
@@ -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;
 }
 \f
 /*
@@ -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,