Commit f924a0a32 for imagemagick.org
commit f924a0a326c92571c07dbb16d5f3848f31c89c86
Author: Dirk Lemstra <dirk@lemstra.org>
Date: Sat Nov 7 22:58:33 2026 +0100
Corrected the PCXWritePixels implementation.
diff --git a/coders/pcx.c b/coders/pcx.c
index 154a20bb9..7526547d1 100644
--- a/coders/pcx.c
+++ b/coders/pcx.c
@@ -829,8 +829,10 @@ static MagickBooleanType PCXWritePixels(PCXInfo *pcx_info,
{
if (pcx_info->encoding == 0)
{
- for (x=0; x < (ssize_t) pcx_info->bytes_per_line; x++)
- (void) WriteBlobByte(image,(unsigned char) (*q++));
+ if (WriteBlob(image,(size_t) pcx_info->bytes_per_line,q) !=
+ (ssize_t) pcx_info->bytes_per_line)
+ return(MagickFalse);
+ q+=pcx_info->bytes_per_line;
}
else
{
@@ -847,18 +849,22 @@ static MagickBooleanType PCXWritePixels(PCXInfo *pcx_info,
if ((count > 1) || ((previous & 0xc0) == 0xc0))
{
count|=0xc0;
- (void) WriteBlobByte(image,(unsigned char) count);
+ if (WriteBlobByte(image,(unsigned char) count) != 1)
+ return(MagickFalse);
}
- (void) WriteBlobByte(image,previous);
+ if (WriteBlobByte(image,previous) != 1)
+ return(MagickFalse);
previous=packet;
count=1;
}
if ((count > 1) || ((previous & 0xc0) == 0xc0))
{
count|=0xc0;
- (void) WriteBlobByte(image,(unsigned char) count);
+ if (WriteBlobByte(image,(unsigned char) count) != 1)
+ return(MagickFalse);
}
- (void) WriteBlobByte(image,previous);
+ if (WriteBlobByte(image,previous) != 1)
+ return(MagickFalse);
}
}
return (MagickTrue);