[PATCH] DestroyContributionThreadSet() segfaults
Posted: 2012-07-30T01:59:42-07:00
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:
Here is a patch to fix it:
Code: Select all
GetMagickResourceLimit(ThreadResource) > GetOpenMPMaximumThreads()
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]);