From: Cristy Date: Mon, 11 Feb 2019 19:56:15 +0000 (-0500) Subject: ... X-Git-Tag: 7.0.8-28~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=581002505b2625d7e7523a56e34657bf473cdd01;p=imagemagick ... --- diff --git a/coders/wpg.c b/coders/wpg.c index f2c024afb..756c41c26 100644 --- a/coders/wpg.c +++ b/coders/wpg.c @@ -1101,6 +1101,7 @@ static Image *ReadWPGImage(const ImageInfo *image_info, image->columns = 1; image->rows = 1; image->colors = 0; + image->storage_class=DirectClass; (void) ResetImagePixels(image,exception); bpp=0; BitmapHeader2.RotAngle=0; @@ -1244,9 +1245,28 @@ static Image *ReadWPGImage(const ImageInfo *image_info, else { if (bpp < 24) - if ( (image->colors < (one << bpp)) && (bpp != 24) ) + if ( (image->colors < (one << bpp)) && (bpp != 24) ) + { + PixelInfo + *colormap; + + size_t + colors; + + colormap=image->colormap; + colors=image->colors; + image->colormap=(PixelInfo *) NULL; if (AcquireImageColormap(image,one << bpp,exception) == MagickFalse) - goto NoMemory; + { + colormap=(PixelInfo *) + RelinquishMagickMemory(colormap); + goto NoMemory; + } + (void) memcpy(image->colormap,colormap,colors* + sizeof(*image->colormap)); + colormap=(PixelInfo *) + RelinquishMagickMemory(colormap); + } } if ((bpp == 1) && (image->colors > 1))