if (offset2 == 0)
offset2=(MagickOffsetType) (offset + TILE_WIDTH * TILE_WIDTH * 4* 1.5);
/* seek to the tile offset */
- offset=SeekBlob(image, offset, SEEK_SET);
+ if (SeekBlob(image, offset, SEEK_SET) != offset)
+ ThrowBinaryException(CorruptImageError,"InsufficientImageDataInFile",
+ image->filename);
/*
Allocate the image for the tile. NOTE: the last tile in a row or
saved_pos=TellBlob(image);
/* seek to the level offset */
- offset=SeekBlob(image, offset, SEEK_SET);
+ if (SeekBlob(image, offset, SEEK_SET) != offset)
+ ThrowBinaryException(CorruptImageError,"InsufficientImageDataInFile",
+ image->filename);
/* read in the level */
if (load_level (image, inDocInfo, inLayer, exception) == 0)
outLayer->type = ReadBlobMSBLong(image);
(void) ReadBlobStringWithLongSize(image, outLayer->name,
sizeof(outLayer->name),exception);
+ if (EOFBlob(image) != MagickFalse)
+ ThrowBinaryException(CorruptImageError,"InsufficientImageDataInFile",
+ image->filename);
/* read the layer properties! */
foundPropEnd = 0;
while ( (foundPropEnd == MagickFalse) && (EOFBlob(image) == MagickFalse) ) {
/* read in the hierarchy */
offset=SeekBlob(image, (MagickOffsetType) hierarchy_offset, SEEK_SET);
- if (offset < 0)
+ if (offset != (MagickOffsetType) hierarchy_offset)
(void) ThrowMagickException(exception,GetMagickModule(),
CorruptImageError,"InvalidImageHeader","`%s'",image->filename);
if (load_hierarchy (image, inDocInfo, outLayer, exception) == 0)
*/
saved_pos=TellBlob(image);
/* seek to the layer offset */
- offset=SeekBlob(image,offset,SEEK_SET);
+ if (SeekBlob(image,offset,SEEK_SET) != offset)
+ ThrowBinaryException(CorruptImageError,"NotEnoughPixelData",
+ image->filename);
/* read in the layer */
layer_ok=ReadOneLayer(image_info,image,&doc_info,
&layer_info[current_layer],current_layer,exception);