Magick++ exception bug?

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
mootools
Posts: 19
Joined: 2005-06-30T06:08:40-07:00
Location: France

Magick++ exception bug?

Post by mootools » 2008-11-21T14:13:39-07:00

Hello,

h_b_diff.png can be downloaded here

I think that there is a problem with Magick++ warning exceptions.
Ie. the following code crash on my png image which generate a warning.

Code: Select all

	Magick::Image image;
		try {
			// Read a file into image object
			image.read( "h_b_diff.png" );
		}
		catch( Warning& e)
		{
		}

		// Crop the image to specified size (width, height, xOffset, yOffset)
		image.crop( Geometry(100,100, 100, 100) );
The crash occurs because read throw a warning exception at that line:

Code: Select all

if ( image )
    throwException( image->exception );
and throwException deletes the exception (line DestroyExceptionInfo( &exception_ );)

So, when crop occurs we have:
image->exception.exceptions = NULL
and then the application crashes in InheritException / ResetLinkedListIterator at the beginning of CropImage (function CloneImage).

A better schema would be to not delete the exception when throwException is called with Magick::Image::image

Thanks,
Manuel Jouglet
Mootools

User avatar
magick
Site Admin
Posts: 11043
Joined: 2003-05-31T11:32:55-07:00

Re: Magick++ exception bug?

Post by magick » 2008-11-21T17:03:48-07:00

We can reproduce the problem you posted and have a patch. Look for it in a few days in ImageMagick 6.4.6-1. Thanks.

Post Reply