From: Cristy Date: Sun, 28 Jan 2018 15:07:54 +0000 (-0500) Subject: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5761 X-Git-Tag: 7.0.7-23~237 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73c6cc1f8da1d7f3647056f293c5a10da019c9b7;p=imagemagick https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5761 --- diff --git a/coders/palm.c b/coders/palm.c index 50861e70f..c98c81e07 100644 --- a/coders/palm.c +++ b/coders/palm.c @@ -256,9 +256,10 @@ static Image *ReadPALMImage(const ImageInfo *image_info, *q; size_t + bits_per_pixel, bytes_per_row, flags, - bits_per_pixel, + extent, version, nextDepthOffset, transparentIndex, @@ -405,10 +406,11 @@ static Image *ReadPALMImage(const ImageInfo *image_info, status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); - one_row=(unsigned char *) AcquireQuantumMemory(MagickMax(bytes_per_row, - 2*image->columns),sizeof(*one_row)); + extent=MagickMax(bytes_per_row,2*image->columns); + one_row=(unsigned char *) AcquireQuantumMemory(extent,sizeof(*one_row)); if (one_row == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); + (void) ResetMagickMemory(one_row,0,extent*sizeof(*one_row)); last_row=(unsigned char *) NULL; if (compressionType == PALM_COMPRESSION_SCANLINE) {