Page 1 of 1

[PATCH] DestroyContributionThreadSet() segfaults

Posted: 2012-07-30T01:59:42-07:00
by PHO
On ImageMagick-6.7.8-6 and possibly the trunk, DestroyContributionThreadSet() in magick/resize.c segfaults when the following condition is met, which is usually the case:

Code: Select all

GetMagickResourceLimit(ThreadResource) > GetOpenMPMaximumThreads()
Here is a patch to fix it:

Code: Select all

diff -urN ImageMagick-6.7.8-6.orig/magick/resize.c ImageMagick-6.7.8-6/magick/resize.c
--- ImageMagick-6.7.8-6.orig/magick/resize.c	2012-07-30 17:12:20.000000000 +0900
+++ ImageMagick-6.7.8-6/magick/resize.c	2012-07-30 17:12:44.000000000 +0900
@@ -2097,7 +2097,7 @@
     i;
 
   assert(contribution != (ContributionInfo **) NULL);
-  for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
+  for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++)
     if (contribution[i] != (ContributionInfo *) NULL)
       contribution[i]=(ContributionInfo *) RelinquishAlignedMemory(
         contribution[i]);

Re: [PATCH] DestroyContributionThreadSet() segfaults

Posted: 2012-07-30T04:36:20-07:00
by magick
Thanks for the problem report and patch. We'll add it to the Subversion repository by sometime tomorrow.