diff -up ImageMagick-6.7.8-9/magick/transform.c.splice-crash ImageMagick-6.7.8-9/magick/transform.c
--- ImageMagick-6.7.8-9/magick/transform.c.splice-crash 2012-06-20 15:03:21.000000000 +0200
+++ ImageMagick-6.7.8-9/magick/transform.c 2016-06-02 17:40:43.860641940 +0200
@@ -65,6 +65,7 @@
#include "magick/string_.h"
#include "magick/thread-private.h"
#include "magick/transform.h"
+#define MagickMin(x,y) (((x) < (y)) ? (x) : (y))
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1646,6 +1647,7 @@ MagickExport Image *SpliceImage(const Im
splice_geometry;
ssize_t
+ columns,
y;
/*
@@ -1730,6 +1732,7 @@ MagickExport Image *SpliceImage(const Im
*/
status=MagickTrue;
progress=0;
+ columns=MagickMin(splice_geometry.x,(ssize_t) splice_image->columns);
image_view=AcquireVirtualCacheView(image,exception);
splice_view=AcquireAuthenticCacheView(splice_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
@@ -1753,7 +1756,8 @@ MagickExport Image *SpliceImage(const Im
if (status == MagickFalse)
continue;
- p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);
+ p=GetCacheViewVirtualPixels(image_view,0,y,splice_image->columns,1,
+ exception);
q=QueueCacheViewAuthenticPixels(splice_view,0,y,splice_image->columns,1,
exception);
if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
@@ -1763,7 +1767,7 @@ MagickExport Image *SpliceImage(const Im
}
indexes=GetCacheViewAuthenticIndexQueue(image_view);
splice_indexes=GetCacheViewAuthenticIndexQueue(splice_view);
- for (x=0; x < splice_geometry.x; x++)
+ for (x=0; x < columns; x++)
{
SetPixelRed(q,GetPixelRed(p));
SetPixelGreen(q,GetPixelGreen(p));
@@ -1833,10 +1837,10 @@ MagickExport Image *SpliceImage(const Im
if (status == MagickFalse)
continue;
- p=GetCacheViewVirtualPixels(image_view,0,y-(ssize_t) splice_geometry.height,
- image->columns,1,exception);
- if ((y < 0) || (y >= (ssize_t) splice_image->rows))
+ if ((y < 0) || (y >= (ssize_t)splice_image->rows))
continue;
+ p=GetCacheViewVirtualPixels(image_view,0,y-(ssize_t) splice_geometry.height,
+ splice_image->columns,1,exception);
q=QueueCacheViewAuthenticPixels(splice_view,0,y,splice_image->columns,1,
exception);
if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
@@ -1846,7 +1850,7 @@ MagickExport Image *SpliceImage(const Im
}
indexes=GetCacheViewAuthenticIndexQueue(image_view);
splice_indexes=GetCacheViewAuthenticIndexQueue(splice_view);
- for (x=0; x < splice_geometry.x; x++)
+ for (x=0; x < columns; x++)
{
SetPixelRed(q,GetPixelRed(p));
SetPixelGreen(q,GetPixelGreen(p));