From: cristy Date: Thu, 8 Jan 2015 15:44:24 +0000 (+0000) Subject: http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=26848 X-Git-Tag: 7.0.1-0~1479 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bd96074b254c6607a0f7731e59f923ad19d5a46d;p=imagemagick http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=26848 --- diff --git a/coders/sun.c b/coders/sun.c index a25eae628..8f92fc371 100644 --- a/coders/sun.c +++ b/coders/sun.c @@ -326,28 +326,17 @@ static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception) size_t one; - image->storage_class=PseudoClass; image->colors=sun_info.maplength; one=1; if (sun_info.maptype == RMT_NONE) image->colors=one << sun_info.depth; if (sun_info.maptype == RMT_EQUAL_RGB) image->colors=sun_info.maplength/3; + if (AcquireImageColormap(image,image->colors,exception) == MagickFalse) + ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } switch (sun_info.maptype) { - case RMT_NONE: - { - if (sun_info.depth < 24) - { - /* - Create linear color ramp. - */ - if (AcquireImageColormap(image,image->colors,exception) == MagickFalse) - ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); - } - break; - } case RMT_EQUAL_RGB: { unsigned char @@ -356,8 +345,6 @@ static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Read SUN raster colormap. */ - if (AcquireImageColormap(image,image->colors,exception) == MagickFalse) - ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); sun_colormap=(unsigned char *) AcquireQuantumMemory(image->colors, sizeof(*sun_colormap)); if (sun_colormap == (unsigned char *) NULL)