found the following issue in the latest ImageMagick source package. Not sure when this was introduced:
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <wand/MagickWand.h>
int main(int argc,char **argv)
{
MagickWandGenesis();
MagickWandTerminus();
return(0);
}
Code: Select all
# gdb --args ./wand
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu"...
(gdb) run
Starting program: /tmp/trunk/wand
[Thread debugging using libthread_db enabled]
wand: magick/semaphore.c:290: LockSemaphoreInfo: Assertion `semaphore_info != (SemaphoreInfo *) ((void *)0)' failed.
[New Thread 0x7f34247137a0 (LWP 12908)]
Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7f34247137a0 (LWP 12908)]
0x00007f34211a1d25 in raise () from /lib/libc.so.6
(gdb) bt
#0 0x00007f34211a1d25 in raise () from /lib/libc.so.6
#1 0x00007f34211a4de1 in abort () from /lib/libc.so.6
#2 0x00007f342119af99 in __assert_fail () from /lib/libc.so.6
#3 0x00007f3423efc4cf in LockSemaphoreInfo (semaphore_info=0x0) at magick/semaphore.c:290
#4 0x00007f34242f4b90 in DestroyWandIds () at wand/wand.c:116
#5 0x00007f34242a8db9 in MagickWandTerminus () at wand/magick-wand.c:994
#6 0x0000000000400785 in main ()
It seems that the semaphore info gets allocated when first MagickWand instance is created. This patch seems to fix the issue but I am not sure if it's 100% right thing to do:
Code: Select all
Index: wand/wand.c
===================================================================
--- wand/wand.c (revision 510)
+++ wand/wand.c (working copy)
@@ -113,12 +113,15 @@
*/
WandExport void DestroyWandIds(void)
{
- (void) LockSemaphoreInfo(wand_semaphore);
+ if (wand_semaphore != (SemaphoreInfo *)NULL)
+ (void) LockSemaphoreInfo(wand_semaphore);
if (wand_ids != (SplayTreeInfo *) NULL)
wand_ids=DestroySplayTree(wand_ids);
instantiate_wand=MagickFalse;
- (void) UnlockSemaphoreInfo(wand_semaphore);
- DestroySemaphoreInfo(&wand_semaphore);
+ if (wand_semaphore != (SemaphoreInfo *)NULL) {
+ (void) UnlockSemaphoreInfo(wand_semaphore);
+ DestroySemaphoreInfo(&wand_semaphore);
+ }
}
/*
Index: ChangeLog
===================================================================
--- ChangeLog (revision 510)
+++ ChangeLog (working copy)
@@ -1,3 +1,6 @@
+2009-10-28 6.5.7-4 Mikko <mkoppanen@php.net>
+ * Fix assert error when no SemaphoreInfo is NULL
+
2009-10-28 6.5.7-3 Cristy <quetzlzacatenango@image...>
* Convert SVG clipping path points from unsigned to long.