You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
GraphicsMagick/GraphicsMagick-CVE-2017-116...

55 lines
1.8 KiB

# HG changeset patch
# User Bob Friesenhahn <bfriesen@GraphicsMagick.org>
# Date 1500771092 18000
# Node ID f3ffc5541257cfbbe1dc93e3f0775cc8d2de96fd
# Parent db732abd9318246cca5b07b56b58a22f39d342e0
PCL: Fix null pointer dereference in writing monochrome images.
diff -r db732abd9318 -r f3ffc5541257 coders/pcl.c
--- a/coders/pcl.c Sat Jul 22 17:56:27 2017 -0500
+++ b/coders/pcl.c Sat Jul 22 19:51:32 2017 -0500
@@ -1010,7 +1010,16 @@
for (x=0; x < (long) image->columns; x++)
{
byte<<=1;
- if (indexes[x] == blk_ind) byte |= 1;
+ if (image->storage_class == PseudoClass)
+ {
+ if (indexes[x] == blk_ind)
+ byte |= 1;
+ }
+ else
+ {
+ if (p[x].red == 0)
+ byte |= 1;
+ }
bit++;
if (bit == 8)
{
@@ -1028,10 +1037,20 @@
/*
8 bit PseudoClass row
*/
- indexes=AccessImmutableIndexes(image);
- for (x=0; x < (long) image->columns; x++)
+ if (image->storage_class == PseudoClass)
{
- *q++=indexes[x];
+ indexes=AccessImmutableIndexes(image);
+ for (x=0; x < (long) image->columns; x++)
+ {
+ *q++=indexes[x];
+ }
+ }
+ else
+ {
+ for (x=0; x < (long) image->columns; x++)
+ {
+ *q++=PixelIntensityRec601(&p[x]);
+ }
}
}
else