From: cristy Date: Sat, 17 May 2014 13:59:57 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~2333 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4f631e2a605598c292826c8220dcda57d8d69c52;p=imagemagick --- diff --git a/MagickCore/colormap.c b/MagickCore/colormap.c index 04644882f..e5b53e206 100644 --- a/MagickCore/colormap.c +++ b/MagickCore/colormap.c @@ -89,8 +89,8 @@ % % The format of the AcquireImageColormap method is: % -% MagickBooleanType AcquireImageColormap(Image *image, -% const size_t colors,ExceptionInfo *exception) +% MagickBooleanType AcquireImageColormap(Image *image,const size_t colors, +% ExceptionInfo *exception) % % A description of each parameter follows: % @@ -116,9 +116,6 @@ MagickExport MagickBooleanType AcquireImageColormap(Image *image, register ssize_t i; - size_t - length; - /* Allocate image colormap. */ @@ -126,14 +123,13 @@ MagickExport MagickBooleanType AcquireImageColormap(Image *image, assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); - image->colors=colors; - length=(size_t) colors; + image->colors=MagickMax(colors,2); if (image->colormap == (PixelInfo *) NULL) - image->colormap=(PixelInfo *) AcquireQuantumMemory(length, + image->colormap=(PixelInfo *) AcquireQuantumMemory(image->colors, sizeof(*image->colormap)); else - image->colormap=(PixelInfo *) ResizeQuantumMemory(image->colormap,length, - sizeof(*image->colormap)); + image->colormap=(PixelInfo *) ResizeQuantumMemory(image->colormap, + image->colors,sizeof(*image->colormap)); if (image->colormap == (PixelInfo *) NULL) ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename);