}
static unsigned char *DecodeImage(Image *blob,Image *image,
- size_t bytes_per_line,const unsigned int bits_per_pixel,size_t *extent,
- ExceptionInfo *exception)
+ size_t bytes_per_line,const unsigned int bits_per_pixel,size_t *extent)
{
+ MagickBooleanType
+ status;
+
MagickSizeType
number_pixels;
return((unsigned char *) NULL);
}
(void) memset(scanline,0,2*row_bytes*sizeof(*scanline));
+ status=MagickTrue;
if (bytes_per_line < 8)
{
/*
count=ReadBlob(blob,(size_t) number_pixels,scanline);
if (count != (ssize_t) number_pixels)
{
- (void) ThrowMagickException(exception,GetMagickModule(),
- CorruptImageError,"UnableToUncompressImage","`%s'",
- image->filename);
+ status=MagickFalse;
break;
}
p=ExpandBuffer(scanline,&number_pixels,bits_per_pixel);
if ((q+number_pixels) > (pixels+(*extent)))
{
- (void) ThrowMagickException(exception,GetMagickModule(),
- CorruptImageError,"UnableToUncompressImage","`%s'",
- image->filename);
+ status=MagickFalse;
break;
}
(void) memcpy(q,p,(size_t) number_pixels);
}
scanline=(unsigned char *) RelinquishMagickMemory(scanline);
+ if (status == MagickFalse)
+ pixels=(unsigned char *) RelinquishMagickMemory(pixels);
return(pixels);
}
/*
scanline_length=(size_t) ReadBlobByte(blob);
if ((scanline_length >= row_bytes) || (scanline_length == 0))
{
- //(void) ThrowMagickException(exception,GetMagickModule(),
- // CorruptImageError,"UnableToUncompressImage","`%s'",image->filename);
+ status=MagickFalse;
break;
}
count=ReadBlob(blob,scanline_length,scanline);
if (count != (ssize_t) scanline_length)
{
- (void) ThrowMagickException(exception,GetMagickModule(),
- CorruptImageError,"UnableToUncompressImage","`%s'",image->filename);
+ status=MagickFalse;
break;
}
for (j=0; j < (ssize_t) scanline_length; )
}
}
scanline=(unsigned char *) RelinquishMagickMemory(scanline);
+ if (status == MagickFalse)
+ pixels=(unsigned char *) RelinquishMagickMemory(pixels);
return(pixels);
}
\f
if ((code != 0x9a) && (code != 0x9b) &&
(bytes_per_line & 0x8000) == 0)
pixels=DecodeImage(image,tile_image,(size_t) bytes_per_line,1,
- &extent,exception);
+ &extent);
else
pixels=DecodeImage(image,tile_image,(size_t) bytes_per_line,
- (unsigned int) pixmap.bits_per_pixel,&extent,exception);
+ (unsigned int) pixmap.bits_per_pixel,&extent);
if (pixels == (unsigned char *) NULL)
- ThrowPICTException(ResourceLimitError,"MemoryAllocationFailed");
+ ThrowPICTException(CorruptImageError,"UnableToUncompressImage");
/*
Convert PICT tile image to pixel packets.
*/