File ImageMagick-CVE-2014-9838.patch of Package ImageMagick.8212

--- a/magick/cache.c
+++ b/magick/cache.c
@@ -3559,7 +3559,8 @@ static MagickBooleanType OpenPixelCache(Image *image,const MapMode mode,
     packet_size+=sizeof(IndexPacket);
   length=number_pixels*packet_size;
   columns=(size_t) (length/cache_info->rows/packet_size);
-  if (cache_info->columns != columns)
+  if ((cache_info->columns != columns) || ((ssize_t) cache_info->columns < 0) ||
+      ((ssize_t) cache_info->rows < 0))
     ThrowBinaryException(ResourceLimitError,"PixelCacheAllocationFailed",
       image->filename);
   cache_info->length=length;