File ImageMagick-CVE-2016-6520.patch of Package ImageMagick.5842
Index: ImageMagick-6.8.9-8/magick/enhance.c
===================================================================
--- ImageMagick-6.8.9-8.orig/magick/enhance.c 2016-08-04 13:50:10.794189654 +0200
+++ ImageMagick-6.8.9-8/magick/enhance.c 2016-08-04 14:28:37.196657844 +0200
@@ -1184,6 +1184,8 @@ MagickExport MagickBooleanType ContrastS
exception=(&image->exception);
if (IsGrayImage(image,exception) != MagickFalse)
(void) SetImageColorspace(image,GRAYColorspace);
+ if (SyncImagePixelCache(image,exception) == MagickFalse)
+ return(MagickFalse);
status=MagickTrue;
(void) ResetMagickMemory(histogram,0,(MaxMap+1)*sizeof(*histogram));
image_view=AcquireAuthenticCacheView(image,exception);
@@ -1803,7 +1805,8 @@ MagickExport MagickBooleanType EqualizeI
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
-
+ if (SyncImagePixelCache(image,&image->exception) == MagickFalse)
+ return(MagickFalse);
/* Call OpenCL version */
status = AccelerateEqualizeImage(image, channel, &image->exception);
if (status != MagickFalse)