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.
44 lines
2.0 KiB
44 lines
2.0 KiB
8 years ago
|
|
||
|
# HG changeset patch
|
||
|
# User Bob Friesenhahn <bfriesen@GraphicsMagick.org>
|
||
|
# Date 1500758975 18000
|
||
|
# Node ID 29550606d8b9bf74f9aea0637d11d19fe706871b
|
||
|
# Parent 30cd2b31f7e045de4861b102e3f8d83db579bc7a
|
||
|
MAP: Fix null pointer dereference or SEGV if input is not colormapped.
|
||
|
|
||
|
diff -r 30cd2b31f7e0 -r 29550606d8b9 coders/map.c
|
||
|
--- a/coders/map.c Sat Jul 22 15:40:00 2017 -0500
|
||
|
+++ b/coders/map.c Sat Jul 22 16:29:35 2017 -0500
|
||
|
@@ -18,7 +18,7 @@
|
||
|
% M M A A P %
|
||
|
% %
|
||
|
% %
|
||
|
-% Read/Write Image Colormaps As An Image File %
|
||
|
+% Read/Write Image Colormaps And Image File %
|
||
|
% %
|
||
|
% %
|
||
|
% Software Design %
|
||
|
@@ -349,16 +349,17 @@
|
||
|
/*
|
||
|
Allocate colormap.
|
||
|
*/
|
||
|
- if (!IsPaletteImage(image,&image->exception))
|
||
|
- (void) SetImageType(image,PaletteType);
|
||
|
+ if (SetImageType(image,PaletteType) == MagickFail)
|
||
|
+ ThrowMAPWriterException(ResourceLimitError,MemoryAllocationFailed,image);
|
||
|
packet_size=image->depth > 8 ? 2 : 1;
|
||
|
- pixels=MagickAllocateMemory(unsigned char *,image->columns*packet_size);
|
||
|
+ pixels=MagickAllocateArray(unsigned char *,image->columns,packet_size);
|
||
|
if (pixels == (unsigned char *) NULL)
|
||
|
ThrowMAPWriterException(ResourceLimitError,MemoryAllocationFailed,image);
|
||
|
packet_size=image->colors > 256 ? 6 : 3;
|
||
|
- colormap=MagickAllocateMemory(unsigned char *,packet_size*image->colors);
|
||
|
+ colormap=MagickAllocateArray(unsigned char *,packet_size,image->colors);
|
||
|
if (colormap == (unsigned char *) NULL)
|
||
|
ThrowMAPWriterException(ResourceLimitError,MemoryAllocationFailed,image);
|
||
|
+
|
||
|
/*
|
||
|
Write colormap to file.
|
||
|
*/
|
||
|
|