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.
GraphicsMagick/GraphicsMagick-CVE-2017-116...

43 lines
1.3 KiB

# HG changeset patch
# User Bob Friesenhahn <bfriesen@GraphicsMagick.org>
# Date 1500764187 18000
# Node ID db732abd9318246cca5b07b56b58a22f39d342e0
# Parent 29550606d8b9bf74f9aea0637d11d19fe706871b
MPC: Fix memory leak while writing Magick Persistent Cache format.
diff -r 29550606d8b9 -r db732abd9318 magick/pixel_cache.c
--- a/magick/pixel_cache.c Sat Jul 22 16:29:35 2017 -0500
+++ b/magick/pixel_cache.c Sat Jul 22 17:56:27 2017 -0500
@@ -3458,7 +3458,10 @@
cache_info->type=DiskCache;
cache_info->offset=(*offset);
if (!OpenCache(clone_image,IOMode,exception))
- return(MagickFail);
+ {
+ DestroyImage(clone_image);
+ return(MagickFail);
+ }
y=0;
{
ViewInfo
@@ -3495,11 +3498,13 @@
CloseCacheView(image_view);
CloseCacheView(clone_view);
}
- cache_info=(CacheInfo*) ReferenceCache(cache_info);
+ if (y < (long) image->rows)
+ {
+ DestroyImage(clone_image);
+ return(MagickFail);
+ }
+ *offset+=cache_info->length+pagesize-(cache_info->length % pagesize);
DestroyImage(clone_image);
- if (y < (long) image->rows)
- return(MagickFail);
- *offset+=cache_info->length+pagesize-(cache_info->length % pagesize);
(void) LogMagickEvent(CacheEvent,GetMagickModule(),"Clone persistent cache");
return(MagickPass);
}