SetLogFormat causes crash
Posted: 2009-11-21T16:46:39-07:00
Hi, a bug was introduced in ImageMagick-6.5.7 that causes it to crash when the method SetLogFormat (in log.c) is called.
I believe that the reason is that SetLogFormat releases the old log format, which is initialized in LoadLogLists to point to the same memory location as the char array in static const LogMap.
Simple example C program that causes the breakage and a proposed patch to fix the problem can be found here:
* sample program: http://tmp.omer.bar-or.org/imagemagick/set_log_format.c
* patch: http://tmp.omer.bar-or.org/imagemagick/ ... rmat.patch
The patch simply creates a new constant string out of LogMap's format in LoadLogLists. It does the same for LogMap's filename, which may cause the same problem if it is ever released (e.g., in LoadLogList).
Thanks,
- Omer.
I believe that the reason is that SetLogFormat releases the old log format, which is initialized in LoadLogLists to point to the same memory location as the char array in static const LogMap.
Simple example C program that causes the breakage and a proposed patch to fix the problem can be found here:
* sample program: http://tmp.omer.bar-or.org/imagemagick/set_log_format.c
* patch: http://tmp.omer.bar-or.org/imagemagick/ ... rmat.patch
The patch simply creates a new constant string out of LogMap's format in LoadLogLists. It does the same for LogMap's filename, which may cause the same problem if it is ever released (e.g., in LoadLogList).
Thanks,
- Omer.