SetLogFormat causes crash

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
omer.baror

SetLogFormat causes crash

Post by omer.baror »

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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: SetLogFormat causes crash

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.5.7-10 Beta available by sometime tomorrow. Thanks.
Post Reply