File ImageMagick-CVE-2019-7175.patch of Package ImageMagick.30356
diff --git a/coders/pcd.c b/coders/pcd.c
index 8eb8ac6526..7e48c138c6 100644
--- a/coders/pcd.c
+++ b/coders/pcd.c
@@ -204,6 +204,8 @@ static MagickBooleanType DecodeImage(Image *image,unsigned char *luma,
if (pcd_table[i] == (PCDTable *) NULL)
{
buffer=(unsigned char *) RelinquishMagickMemory(buffer);
+ for (j=0; j < i; j++)
+ pcd_table[j]=(PCDTable *) RelinquishMagickMemory(pcd_table[j]);
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
}
@@ -215,6 +217,8 @@ static MagickBooleanType DecodeImage(Image *image,unsigned char *luma,
if (r->length > 16)
{
buffer=(unsigned char *) RelinquishMagickMemory(buffer);
+ for (j=0; j <= i; j++)
+ pcd_table[j]=(PCDTable *) RelinquishMagickMemory(pcd_table[j]);
return(MagickFalse);
}
PCDGetBits(16);