From 025e77fcb2f45b21689931ba3bf74eac153afa48 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 22 Jun 2019 08:24:14 -0400 Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/1615 --- MagickCore/statistic.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/MagickCore/statistic.c b/MagickCore/statistic.c index 50d56fcf7..b5ed38c61 100644 --- a/MagickCore/statistic.c +++ b/MagickCore/statistic.c @@ -163,18 +163,17 @@ static PixelChannels **AcquirePixelThreadSet(const Image *images) size_t columns, - number_threads; + rows; - number_threads=(size_t) GetMagickResourceLimit(ThreadResource); - pixels=(PixelChannels **) AcquireQuantumMemory(number_threads, - sizeof(*pixels)); + rows=MagickMax(GetImageListLength(images), + (size_t) GetMagickResourceLimit(ThreadResource)); + pixels=(PixelChannels **) AcquireQuantumMemory(rows,sizeof(*pixels)); if (pixels == (PixelChannels **) NULL) return((PixelChannels **) NULL); - (void) memset(pixels,0,number_threads*sizeof(*pixels)); - columns=images->columns; + columns=MaxPixelChannels; for (next=images; next != (Image *) NULL; next=next->next) columns=MagickMax(next->columns,columns); - for (i=0; i < (ssize_t) number_threads; i++) + for (i=0; i < (ssize_t) rows; i++) { register ssize_t j; -- 2.40.0