Page 1 of 1

why readImages() function does not catch the exception?

Posted: 2013-08-16T01:30:45-07:00
by JeongSeok, Yang
Image Magick version: ImageMagick-6.7.5-2
System: Linux

When I try to open the file that is maybe not a real image file,
The below codes works differently at Magick::readImages().
I'd like to know why.
The input file is here( http://cfile221.uf.daum.net/attach/262A ... E0F60D8E69 )

On the Ubuntu system,
Linux ubuntu 3.8.0-27-generic #40-Ubuntu SMP Tue Jul 9 00:17:05 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux (by $ uname -a )
The exception is caught by well at the line of "catch (Magick::Exception & e)"
I think this is a normal behavior.

But on the Radhat system
Linux s-receiver7 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Linux (by $ uname -a )
It just causes crash whitout catching the exception.
That is , it showes "Segmentation fault".

What should I check?

I hope it works like it does on the Ubuntu system.

bool openFile(Image &image, const string & path) {
list<Image> image_list;

try {
Magick::readImages(&image_list, path);
} catch (Magick::Exception & e) {
cerr<<"what(): "<<e.what()<<endl;
return false;
} catch (...) {
cerr << "ImageMagick::openFile() - exception catch(...)" << endl;
return false;
}
image = image_list.front();
return true;
}

Thanks.

Re: why readImages() function does not catch the exception?

Posted: 2013-08-16T01:51:58-07:00
by dlemstra
Are you using the same version of ImageMagick on both servers?

Re: why readImages() function does not catch the exception?

Posted: 2013-08-16T01:59:05-07:00
by JeongSeok, Yang
Yes I am using the same version on the server and on Unbuntu desktop.