*q++=ScaleQuantumToChar(GetPixelBlue(image,p));
*q++=ScaleQuantumToChar(GetPixelGreen(image,p));
*q++=ScaleQuantumToChar(GetPixelRed(image,p));
- *q=ScaleQuantumToChar((Quantum) (image->alpha_trait != UndefinedPixelTrait ?
- GetPixelAlpha(image,p) : OpaqueAlpha));
+ *q=ScaleQuantumToChar((Quantum) (image->alpha_trait !=
+ UndefinedPixelTrait ? GetPixelAlpha(image,p) : OpaqueAlpha));
if (*q == 255)
*q=254;
p+=GetPixelChannels(image);
o destroy the secondary image.
*/
- (void) CloseBlob(color_image);
+ if (color_image != (Image *) NULL)
+ (void) CloseBlob(color_image);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
if (memcmp(type,mng_MHDR,4) == 0)
{
+ if (length != 28)
+ {
+ if (chunk)
+ chunk=(unsigned char *) RelinquishMagickMemory(chunk);
+ ThrowReaderException(CorruptImageError,"CorruptImage");
+ }
+
mng_info->mng_width=(size_t) ((p[0] << 24) | (p[1] << 16) |
(p[2] << 8) | p[3]);
frame_delay=default_frame_delay;
simplicity=0;
- if (length > 16)
- {
- p+=16;
- simplicity=(size_t) mng_get_long(p);
- }
+ p+=16;
+ simplicity=(size_t) mng_get_long(p);
mng_type=1; /* Full MNG */
int
repeat=0;
-
if (length != 0)
repeat=p[0];
CoderError,"DEFI chunk found in MNG-VLC datastream","`%s'",
image->filename);
+ if (length < 2)
+ {
+ if (chunk)
+ chunk=(unsigned char *) RelinquishMagickMemory(chunk);
+ ThrowReaderException(CorruptImageError,"CorruptImage");
+ }
+
object_id=(p[0] << 8) | p[1];
if (mng_type == 2 && object_id != 0)
{
/* read global tRNS */
- if (length < 257)
+ if (length > 0 && length < 257)
for (i=0; i < (ssize_t) length; i++)
mng_info->global_trns[i]=p[i];
register ssize_t
j;
- for (j=0; j < (ssize_t) length; j+=2)
+ for (j=1; j < (ssize_t) length; j+=2)
{
- i=p[j] << 8 | p[j+1];
+ i=p[j-1] << 8 | p[j];
MngInfoDiscardObject(mng_info,i);
}
}