From: cristy Date: Mon, 4 Oct 2010 17:32:27 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~8760 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=33503f57a9c282bf61efdd7792ed5447b8d920c0;p=imagemagick --- diff --git a/ChangeLog b/ChangeLog index 139f5871e..8abbc3e03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2010-10-03 6.6.4-9 Cristy * Fix memory assertion with --enable-embeddable (reference http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=17201). + * Don't permit access to pixels when pinging an image (reference + http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=17194). 2010-10-02 6.6.4-9 Anthony Thyssen * Added sqrt(2) bluring default for Gaussian Filter if used as a diff --git a/magick/stream.c b/magick/stream.c index 936e879ae..ac1af83a7 100644 --- a/magick/stream.c +++ b/magick/stream.c @@ -703,17 +703,21 @@ static const PixelPacket *GetVirtualPixelStream(const Image *image, /* Pixels are stored in a temporary buffer until they are synced to the cache. */ + cache_info->active_index_channel=((image->storage_class == PseudoClass) || + (image->colorspace == CMYKColorspace)) ? MagickTrue : MagickFalse; number_pixels=(MagickSizeType) columns*rows; length=(size_t) number_pixels*sizeof(PixelPacket); - if ((image->storage_class == PseudoClass) || - (image->colorspace == CMYKColorspace)) + if (cache_info->active_index_channel != MagickFalse) length+=number_pixels*sizeof(IndexPacket); if (cache_info->pixels == (PixelPacket *) NULL) { cache_info->length=length; status=AcquireStreamPixels(cache_info,exception); if (status == MagickFalse) - return((PixelPacket *) NULL); + { + cache_info->length=0; + return((PixelPacket *) NULL); + } } else if (cache_info->length != length) @@ -722,11 +726,13 @@ static const PixelPacket *GetVirtualPixelStream(const Image *image, cache_info->length=length; status=AcquireStreamPixels(cache_info,exception); if (status == MagickFalse) - return((PixelPacket *) NULL); + { + cache_info->length=0; + return((PixelPacket *) NULL); + } } cache_info->indexes=(IndexPacket *) NULL; - if ((image->storage_class == PseudoClass) || - (image->colorspace == CMYKColorspace)) + if (cache_info->active_index_channel != MagickFalse) cache_info->indexes=(IndexPacket *) (cache_info->pixels+number_pixels); return(cache_info->pixels); } @@ -855,12 +861,13 @@ static PixelPacket *QueueAuthenticPixelsStream(Image *image,const ssize_t x, /* Pixels are stored in a temporary buffer until they are synced to the cache. */ + cache_info->active_index_channel=((image->storage_class == PseudoClass) || + (image->colorspace == CMYKColorspace)) ? MagickTrue : MagickFalse; cache_info->columns=columns; cache_info->rows=rows; number_pixels=(MagickSizeType) columns*rows; length=(size_t) number_pixels*sizeof(PixelPacket); - if ((image->storage_class == PseudoClass) || - (image->colorspace == CMYKColorspace)) + if (cache_info->active_index_channel != MagickFalse) length+=number_pixels*sizeof(IndexPacket); if (cache_info->pixels == (PixelPacket *) NULL) { @@ -877,8 +884,7 @@ static PixelPacket *QueueAuthenticPixelsStream(Image *image,const ssize_t x, if (cache_info->pixels == (void *) NULL) return((PixelPacket *) NULL); cache_info->indexes=(IndexPacket *) NULL; - if ((image->storage_class == PseudoClass) || - (image->colorspace == CMYKColorspace)) + if (cache_info->active_index_channel != MagickFalse) cache_info->indexes=(IndexPacket *) (cache_info->pixels+number_pixels); return(cache_info->pixels); }