From: cristy Date: Wed, 3 Nov 2010 01:05:41 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~8580 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=91e5262e4b20aa089bdd3e3bad29e5f621f7776b;p=imagemagick --- diff --git a/coders/pcl.c b/coders/pcl.c index 48120084d..0fc6ca823 100644 --- a/coders/pcl.c +++ b/coders/pcl.c @@ -505,8 +505,9 @@ static size_t PCLDeltaCompressImage(const size_t length, } j++; } - for ( ; x < (ssize_t) length; x++) + while (x < (ssize_t) length) { + x++; if (*pixels == *previous_pixels) break; i++; @@ -801,10 +802,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+256,sizeof(*pixels)); + pixels=(unsigned char *) AcquireQuantumMemory(length+1,sizeof(*pixels)); if (pixels == (unsigned char *) NULL) ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); - (void) ResetMagickMemory(pixels,0,(length+256)*sizeof(*pixels)); + (void) ResetMagickMemory(pixels,0,(length+1)*sizeof(*pixels)); compress_pixels=(unsigned char *) NULL; previous_pixels=(unsigned char *) NULL; switch (image->compression) @@ -832,16 +833,16 @@ static MagickBooleanType WritePCLImage(const ImageInfo *image_info,Image *image) } default: { - compress_pixels=(unsigned char *) AcquireQuantumMemory(length+ - (length >> 3)+256,sizeof(*compress_pixels)); + compress_pixels=(unsigned char *) AcquireQuantumMemory(length+32, + sizeof(*compress_pixels)); if (compress_pixels == (unsigned char *) NULL) { pixels=(unsigned char *) RelinquishMagickMemory(pixels); ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); } - (void) ResetMagickMemory(compress_pixels,0,(length+(length >> 3)+256)* + (void) ResetMagickMemory(compress_pixels,0,(length+32)* sizeof(*compress_pixels)); - previous_pixels=(unsigned char *) AcquireQuantumMemory(length+256, + previous_pixels=(unsigned char *) AcquireQuantumMemory(length+1, sizeof(*previous_pixels)); if (previous_pixels == (unsigned char *) NULL) { @@ -850,7 +851,7 @@ static MagickBooleanType WritePCLImage(const ImageInfo *image_info,Image *image) pixels=(unsigned char *) RelinquishMagickMemory(pixels); ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); } - (void) ResetMagickMemory(previous_pixels,0,(length+256)* + (void) ResetMagickMemory(previous_pixels,0,(length+1)* sizeof(*previous_pixels)); (void) FormatMagickString(buffer,MaxTextExtent,"\033*b3M"); (void) WriteBlobString(image,buffer);