Open olebole opened 3 years ago
I tried to look into this with a debugger. The primary cause for the crash is that the static LogInfo * log_info
in magick/log.c
is accessed in IsEventLogging()
after it was destroyed (which sets this pointer to NULL). The stack trace for the cleanup is
#0 DestroyLogInfo () at magick/log.c:281
#1 0x00007ffff2e55de5 in DestroyMagick () at magick/magick.c:199
#2 0x00007ffff4e6d059 in Magick::MagickCleanUp::~MagickCleanUp()
(this=<optimized out>, __in_chrg=<optimized out>) at Magick++/lib/Image.cpp:4237
#3 0x00007ffff7c644d7 in __run_exit_handlers
(status=0, listp=0x7ffff7de4718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
#4 0x00007ffff7c6467a in __GI_exit (status=<optimized out>) at exit.c:139
#5 0x00007ffff7c4cd11 in __libc_start_main (main=
0x5ea6b0 <main>, argc=3, argv=0x7fffffffe098, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe088) at ../csu/libc-start.c:342
#6 0x00000000005ea5ea in _start ()
--> The order of the functions called in atexit()
seems wrong; there is an Image
destroyed after the cleanup.
Further info: This does not happen when using ImageMagick.
I found that this happens in line 72 of magick_cl.cpp
. Indeed this seems to be due to double free.
I think #1063 fixes this, I just changed the array to vector, so that it will be automatically freed when exit.
We have a crash #1101 with any magick operation today. reopening this in case fix is just a revert.
I am just packaging the new version for Debian. The build (and builtin tests) look fine. The Python tests also pass, but Python exits with a crash on exit. This is the stacktrace:
The crash happens on cleaning up ImageMagick, so it may be a problem there. But it may also be an urelated bug (double free or so). Any ideas? GraphicsMagic is 1.3.36.
This is reproducible with a simple
python3 -c "import GDL"
.