ImageMagick Vulnerabilities
Posted: 2012-03-28T16:13:26-07:00
Concerning ImageMagick 6.7.6-2 and earlier:
These patches are included in the ImageMagick 6.7.6-3 release. For earlier releases, here are the patches to repair these vulnerabilities:
- [CVE-2012-0259] JPEG EXIF tag crash.
- [CVE-2012-0260] Excessive memory use with JPEG restart markers.
- [CVE-2012-1798] Copying of invalid memory when reading TIFF EXIF IFD.
These patches are included in the ImageMagick 6.7.6-3 release. For earlier releases, here are the patches to repair these vulnerabilities:
Code: Select all
--- ImageMagick-6.7.5-10/magick/property.c 2012-02-29 20:41:19.000000000 -0500
+++ ImageMagick-6.7.6-3/magick/property.c 2012-03-28 19:00:20.537642844 -0400
@@ -1309,6 +1309,8 @@
buffer[MaxTextExtent],
*value;
+ value=(char *) NULL;
+ *buffer='\0';
switch (format)
{
case EXIF_FMT_BYTE:
--- ImageMagick-6.7.5-10/coders/jpeg.c 2012-03-02 12:37:45.000000000 -0500
+++ ImageMagick-6.7.6-3/coders/jpeg.c 2012-03-28 19:00:11.641806710 -0400
@@ -319,6 +320,8 @@
static MagickBooleanType JPEGWarningHandler(j_common_ptr jpeg_info,int level)
{
+#define JPEGExcessiveWarnings 1000
+
char
message[JMSG_LENGTH_MAX];
@@ -337,11 +340,12 @@
Process warning message.
*/
(jpeg_info->err->format_message)(jpeg_info,message);
+ if (jpeg_info->err->num_warnings++ > JPEGExcessiveWarnings)
+ JPEGErrorHandler(jpeg_info);
if ((jpeg_info->err->num_warnings == 0) ||
(jpeg_info->err->trace_level >= 3))
ThrowBinaryException(CorruptImageWarning,(char *) message,
image->filename);
- jpeg_info->err->num_warnings++;
}
else
if ((image->debug != MagickFalse) &&
--- ImageMagick-6.7.5-10/coders/tiff.c 2012-02-13 19:43:58.000000000 -0500
+++ ImageMagick-6.7.6-3/coders/tiff.c 2012-03-28 19:00:06.795895975 -0400
@@ -647,7 +647,7 @@
ascii=(char *) NULL;
if ((TIFFGetField(tiff,exif_info[i].tag,&ascii,&sans,&sans) != 0) &&
(ascii != (char *) NULL) && (*ascii != '\0'))
- (void) CopyMagickMemory(value,ascii,MaxTextExtent);
+ (void) CopyMagickString(value,ascii,MaxTextExtent);
break;
}
case TIFF_SHORT: