program crash on catched coder warning exception (IM 6.3.7)
program crash on catched coder warning exception (IM 6.3.7)
Hello,
I have problem that program crashed on coder warning exception raised:
what: Coder Warning: Corrupt JPEG data: 1027 extraneous bytes before marker 0xd9
Program crashed only one time, but other times program did not get crashed...
Can you provide any hint on this situation? How to make program more stable on such exceptions?
Thanks
I have problem that program crashed on coder warning exception raised:
what: Coder Warning: Corrupt JPEG data: 1027 extraneous bytes before marker 0xd9
Program crashed only one time, but other times program did not get crashed...
Can you provide any hint on this situation? How to make program more stable on such exceptions?
Thanks
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: program crash on catched coder warning exception (IM 6.3.7)
Report a bug with a link to a copy of the image. IM should NOT crash, ever. Give warnings and errors yes, crash no.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: program crash on catched coder warning exception (IM 6.3.7)
what is expected behavior for IM when Magick::WarningCorruptImage catched ?
As I see "DestroyImageList" function fails (pointer is zero). What happens with resources which were taken by corrupted image?
Also IM crash when attempt to delete corrupted file object. So, resources are not freed...
Btw, how can I post sample image files?
As I see "DestroyImageList" function fails (pointer is zero). What happens with resources which were taken by corrupted image?
Also IM crash when attempt to delete corrupted file object. So, resources are not freed...
Btw, how can I post sample image files?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: program crash on catched coder warning exception (IM 6.3.7)
DestroyImageList() will always return a NULL pointer. You use it to assign it back to the image list pointer so you know it is invalid!
You put your image up somewhere on the web (anywhere) am post a link to that image.
Code: Select all
list = DestroyImageList(list)
You put your image up somewhere on the web (anywhere) am post a link to that image.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: program crash on catched coder warning exception (IM 6.3.7)
for example, these files
http://depositfiles.com/files/7651033
http://depositfiles.com/files/7651142
http://depositfiles.com/files/7651172
I use magick++ api.
Thanks
http://depositfiles.com/files/7651033
http://depositfiles.com/files/7651142
http://depositfiles.com/files/7651172
I use magick++ api.
Thanks
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: program crash on catched coder warning exception (IM 6.3.7)
Unable to download the images... The download site does not like my multi-host proxy server as a later request can some from a slightly different IP than the previous request!
Can you please start a new topic in BUGS with the original problem and the links to the files.
thank you.
Can you please start a new topic in BUGS with the original problem and the links to the files.
thank you.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: program crash on catched coder warning exception (IM 6.3.7)
To fix this problem we need a small program we can download to reproduce the problem or a stack trace. We tried converting your DSCF040.JPG image about one hundred times with the latest ImageMagick release, 6.4.3-6, and each time it threw the 'corrupt jpeg data' exception but still exited without crashing.
Re: program crash on catched coder warning exception (IM 6.3.7)
The problem is memory leak. When c++ exception caught, destroying of Magick::Image object causes program crash. In stack trace it is DestroyImageList(NULL) , while on other magick warnings destroying of Magick::Image object does not make program crash, DestroyImageList(!NULL).
Code: Select all
shared_ptr<Magick::Image> magick_image(new Magick::Image());
try
{
magick_image->read(filename_);
}
catch( Magick::WarningCoder &warning )
{
// this exception is OK.
}
catch (Magick::WarningCorruptImage &warning)
{
// this causes crash once magick_image becomes out of scope
}
Re: program crash on catched coder warning exception (IM 6.3.7)
See http://www.imagemagick.org/Magick++/Exception.html. Your program runs fine if you wrap your code with another try:
Code: Select all
try
{
try
{
magick_image->read(filename_);
}
catch( Magick::WarningCoder &warning )
{
// this exception is OK.
}
catch (Magick::WarningCorruptImage &warning)
{
// this causes crash once magick_image becomes out of scope
}
}
catch( std::exception &error )
{
// Process any other exceptions derived from standard C++ exception
err << “Caught C++ STD exception: “ << error.what() << endl;
}
catch( ... )
{
// Process *any* exception (last-ditch effort). There is not a lot
// you can do here other to retry the operation that failed, or exit
// the program.
}
Re: program crash on catched coder warning exception (IM 6.3.7)
Yes, resolved. Thanks. Problem was pointer imageInfo()->size was not NULL befor Magick::Image object destruction. Btw, how memory for imageInfo()->size string must be allocated? (Because it seems that IM tries to free it).
Re: program crash on catched coder warning exception (IM 6.3.7)
Structured string members, in most cases, should be allocated from the heap:
- image_info->size = ConstantString("50x50+0+0");