File GraphicsMagick-CVE-2019-11505.patch of Package GraphicsMagick.10463
diff -r 5a287af63203 -r 85f5bdcd246a coders/pdb.c
--- a/coders/pdb.c Wed Apr 10 11:27:35 2019 -0500
+++ b/coders/pdb.c Wed Apr 10 20:48:28 2019 -0500
@@ -30,6 +30,13 @@
%
%
*/
+/*
+ Some information on this format may be found at
+ http://fileformats.archiveteam.org/wiki/Palm_Database_ImageViewer
+
+ Round-trip tests do not pass so this format is not included in the
+ test suite.
+*/
/*
Include declarations.
@@ -733,6 +740,7 @@
entry->magick=(MagickHandler) IsPDB;
entry->description="Palm Database ImageViewer Format";
entry->module="PDB";
+ entry->coder_class=UnstableCoderClass;
(void) RegisterMagickInfo(entry);
}
@@ -842,7 +850,7 @@
status;
size_t
- packets;
+ packets;
unsigned long
literal,
@@ -867,6 +875,7 @@
if (status == False)
ThrowPDBWriterException(FileOpenError,UnableToOpenFile,image);
(void) TransformColorspace(image,RGBColorspace);
+ (void) SetImageType(image,GrayscaleType);
bits_per_pixel=image->depth;
if (GetImageType(image,&image->exception) == BilevelType)
bits_per_pixel=1;
@@ -939,7 +948,7 @@
if (buffer == (unsigned char *) NULL)
ThrowPDBWriterException(ResourceLimitWarning,MemoryAllocationFailed,image);
(void) memset(buffer,0,512);
- packet_size=image->depth > 8 ? 2: 1;
+ packet_size=bits_per_pixel > 8 ? 2: 1;
scanline=MagickAllocateArray(unsigned char *,image->columns,packet_size);
if (scanline == (unsigned char *) NULL)
ThrowPDBWriterException(ResourceLimitWarning,MemoryAllocationFailed,image);
@@ -956,7 +965,7 @@
{
if (!AcquireImagePixels(image,0,y,image->columns,1,&image->exception))
break;
- (void) ExportImagePixelArea(image,GrayQuantum,image->depth,scanline,0,0);
+ (void) ExportImagePixelArea(image,GrayQuantum,bits_per_pixel,scanline,0,0);
for (x=0; x < pdb_image.width; x++)
{
if (x < (long) image->columns)