% July 1992 %
% %
% %
-% Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2015 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
p++;
size=(size_t)strtol(p,&q,10);
- if (p == q || size < 16 || size > 255)
+ if (p == q || size < 16 || size > 256)
return((Image *) NULL);
p=q;
ReadBlobLSBShort(image);
icon_file.directory[i].size=ReadBlobLSBLong(image);
icon_file.directory[i].offset=ReadBlobLSBLong(image);
+ if (EOFBlob(image) != MagickFalse)
+ {
+ ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
+ image->filename);
+ break;
+ }
}
one=1;
for (i=0; i < icon_file.count; i++)
icon_info.height=(unsigned char) ((int) ReadBlobLSBLong(image)/2);
icon_info.planes=ReadBlobLSBShort(image);
icon_info.bits_per_pixel=ReadBlobLSBShort(image);
+ if (EOFBlob(image) != MagickFalse)
+ {
+ ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
+ image->filename);
+ break;
+ }
if (((icon_info.planes == 18505) && (icon_info.bits_per_pixel == 21060)) ||
(icon_info.size == 0x474e5089))
{
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" bpp = %.20g",(double) icon_info.bits_per_pixel);
}
- if (icon_info.bits_per_pixel <= 16)
+ if ((icon_info.number_colors != 0) || (icon_info.bits_per_pixel <= 16U))
{
image->storage_class=PseudoClass;
image->colors=icon_info.number_colors;
(image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
bytes_per_line=(((image->columns*icon_info.bits_per_pixel)+31) &
~31) >> 3;
(void) bytes_per_line;
entry=SetMagickInfo("CUR");
entry->decoder=(DecodeImageHandler *) ReadICONImage;
entry->encoder=(EncodeImageHandler *) WriteICONImage;
- entry->adjoin=MagickFalse;
- entry->seekable_stream=MagickTrue;
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderSeekableStreamFlag;
entry->description=ConstantString("Microsoft icon");
entry->module=ConstantString("CUR");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("ICO");
entry->decoder=(DecodeImageHandler *) ReadICONImage;
entry->encoder=(EncodeImageHandler *) WriteICONImage;
- entry->adjoin=MagickTrue;
- entry->seekable_stream=MagickTrue;
+ entry->flags|=CoderSeekableStreamFlag;
entry->description=ConstantString("Microsoft icon");
entry->module=ConstantString("ICON");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("ICON");
entry->decoder=(DecodeImageHandler *) ReadICONImage;
entry->encoder=(EncodeImageHandler *) WriteICONImage;
- entry->adjoin=MagickFalse;
- entry->seekable_stream=MagickTrue;
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderSeekableStreamFlag;
entry->description=ConstantString("Microsoft icon");
entry->module=ConstantString("ICON");
(void) RegisterMagickInfo(entry);
*q++=ScaleQuantumToChar(GetPixelBlue(next,p));
*q++=ScaleQuantumToChar(GetPixelGreen(next,p));
*q++=ScaleQuantumToChar(GetPixelRed(next,p));
- if (next->alpha_trait != BlendPixelTrait)
+ if (next->alpha_trait == UndefinedPixelTrait)
*q++=ScaleQuantumToChar(QuantumRange);
else
*q++=ScaleQuantumToChar(GetPixelAlpha(next,p));
for (x=0; x < (ssize_t) next->columns; x++)
{
byte<<=1;
- if ((next->alpha_trait == BlendPixelTrait) &&
+ if ((next->alpha_trait != UndefinedPixelTrait) &&
(GetPixelAlpha(next,p) == (Quantum) TransparentAlpha))
byte|=0x01;
bit++;
}
if (GetNextImageInList(next) == (Image *) NULL)
break;
- next=SyncNextImageInList(next);
status=SetImageProgress(next,SaveImagesTag,scene++,
GetImageListLength(next));
if (status == MagickFalse)
break;
+ next=SyncNextImageInList(next);
} while ((next != (Image *) NULL) && (image_info->adjoin != MagickFalse));
offset=SeekBlob(image,0,SEEK_SET);
(void) offset;