diff options
Diffstat (limited to 'coders/png.c')
-rw-r--r-- | coders/png.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/coders/png.c b/coders/png.c index c838b7d57..ca7151e3f 100644 --- a/coders/png.c +++ b/coders/png.c @@ -18,7 +18,7 @@ % November 1997 % % % % % -% Copyright 1999-2020 ImageMagick Studio LLC, a non-profit organization % +% Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization % % dedicated to making software imaging solutions freely available. % % % % You may not use this file except in compliance with the License. You may % @@ -1790,11 +1790,9 @@ Magick_png_read_raw_profile(png_struct *ping,Image *image, size_t extent, + length, nibbles; - ssize_t - length; - StringInfo *profile; @@ -1808,11 +1806,6 @@ Magick_png_read_raw_profile(png_struct *ping,Image *image, sp=text[ii].text+1; extent=text[ii].text_length; - if ((sp+extent) < sp) - { - png_warning(ping,"invalid profile length"); - return(MagickFalse); - } /* look for newline */ while ((*sp != '\n') && extent--) sp++; @@ -2221,6 +2214,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, *volatile quantum_scanline; ssize_t + ping_rowbytes, y; register unsigned char @@ -2235,7 +2229,6 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, size_t length, - ping_rowbytes, row_offset; ssize_t @@ -6836,8 +6829,7 @@ static Image *ReadOneMNGImage(MngInfo* mng_info, const ImageInfo *image_info, MngBox crop_box; - if (((mng_info->magn_methx > 0) && (mng_info->magn_methx <= 5)) && - ((mng_info->magn_methy > 0) && (mng_info->magn_methy <= 5))) + if (mng_info->magn_methx || mng_info->magn_methy) { png_uint_32 magnified_height, @@ -7677,7 +7669,10 @@ static Image *ReadOneMNGImage(MngInfo* mng_info, const ImageInfo *image_info, next_image=CoalesceImages(image,exception); image=DestroyImageList(image); if (next_image == (Image *) NULL) - return((Image *) NULL); + { + mng_info=MngInfoFreeStruct(mng_info); + return((Image *) NULL); + } image=next_image; for (next=image; next != (Image *) NULL; next=next_image) @@ -9016,7 +9011,7 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info, (void) LogMagickEvent(CoderEvent,GetMagickModule(), " i (red,green,blue,alpha)"); - for (i=0; i < (ssize_t) MagickMin(image->colors,256); i++) + for (i=0; i < 256; i++) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " %d (%d,%d,%d,%d)", @@ -11388,13 +11383,11 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info, (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Allocating %.20g bytes of memory for pixels",(double) rowbytes); } - pixel_info=AcquireVirtualMemory(rowbytes,GetPixelChannels(image)* - sizeof(*ping_pixels)); + pixel_info=AcquireVirtualMemory(rowbytes,sizeof(*ping_pixels)); if (pixel_info == (MemoryInfo *) NULL) png_error(ping,"Allocation of memory for pixels failed"); ping_pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info); - (void) memset(ping_pixels,0,rowbytes*GetPixelChannels(image)* - sizeof(*ping_pixels)); + (void) memset(ping_pixels,0,rowbytes*sizeof(*ping_pixels)); /* Initialize image scanlines. */ |