From: cristy Date: Tue, 2 Nov 2010 16:06:30 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~8581 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=84cb9f4f1f8a368deb9f4b5a5595915a2f87b8bb;p=imagemagick --- diff --git a/coders/pcl.c b/coders/pcl.c index 6da5bbf58..48120084d 100644 --- a/coders/pcl.c +++ b/coders/pcl.c @@ -801,9 +801,10 @@ static MagickBooleanType WritePCLImage(const ImageInfo *image_info,Image *image) (void) WriteBlobString(image,"\033*r1A"); /* start raster graphics */ (void) WriteBlobString(image,"\033*b0Y"); /* set y offset */ length=(image->columns*bits_per_pixel+7)/8; - pixels=(unsigned char *) AcquireQuantumMemory(length,sizeof(*pixels)); + pixels=(unsigned char *) AcquireQuantumMemory(length+256,sizeof(*pixels)); if (pixels == (unsigned char *) NULL) ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); + (void) ResetMagickMemory(pixels,0,(length+256)*sizeof(*pixels)); compress_pixels=(unsigned char *) NULL; previous_pixels=(unsigned char *) NULL; switch (image->compression) @@ -823,6 +824,8 @@ static MagickBooleanType WritePCLImage(const ImageInfo *image_info,Image *image) pixels=(unsigned char *) RelinquishMagickMemory(pixels); ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); } + (void) ResetMagickMemory(compress_pixels,0,(length+256)* + sizeof(*compress_pixels)); (void) FormatMagickString(buffer,MaxTextExtent,"\033*b2M"); (void) WriteBlobString(image,buffer); break; @@ -830,13 +833,15 @@ static MagickBooleanType WritePCLImage(const ImageInfo *image_info,Image *image) default: { compress_pixels=(unsigned char *) AcquireQuantumMemory(length+ - (length >> 3),sizeof(*compress_pixels)); + (length >> 3)+256,sizeof(*compress_pixels)); if (compress_pixels == (unsigned char *) NULL) { pixels=(unsigned char *) RelinquishMagickMemory(pixels); ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); } - previous_pixels=(unsigned char *) AcquireQuantumMemory(length, + (void) ResetMagickMemory(compress_pixels,0,(length+(length >> 3)+256)* + sizeof(*compress_pixels)); + previous_pixels=(unsigned char *) AcquireQuantumMemory(length+256, sizeof(*previous_pixels)); if (previous_pixels == (unsigned char *) NULL) { @@ -845,6 +850,8 @@ static MagickBooleanType WritePCLImage(const ImageInfo *image_info,Image *image) pixels=(unsigned char *) RelinquishMagickMemory(pixels); ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); } + (void) ResetMagickMemory(previous_pixels,0,(length+256)* + sizeof(*previous_pixels)); (void) FormatMagickString(buffer,MaxTextExtent,"\033*b3M"); (void) WriteBlobString(image,buffer); break;