Disable assert/abort

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
avejidah
Posts: 3
Joined: 2011-08-16T08:37:42-07:00
Authentication code: 8675308
Contact:

Disable assert/abort

Post by avejidah »

Using magick++, is it possible to disable the assertions/aborts on corrupt image reads without modifying the library? It seems strange that the library would throw an exception and assert/abort.

Code: Select all

  Image img;

  try 
  {
    img.read(argv[1]);
  }
  catch (exception& ex) 
  {
    cout << "Caught: " << ex.what() << endl;
  }

Code: Select all

Caught: Magick: Corrupt JPEG data: 3052 extraneous bytes before marker 0xd9 `2011-02-27_16-04-00_280.jpg' @ jpeg.c/EmitMessage/227
Not continuing - bad image.
imageTest: magick/semaphore.c:288: LockSemaphoreInfo: Assertion `semaphore_info != (SemaphoreInfo *) ((void *)0)' failed.
Aborted
I have a daemon that is processing images in the background. I don't want the daemon to die just because it encounters a single corrupt image. I do want to know when it encounters a corrupt image, but I want to catch the error and continue.

Ubuntu 10.04
Default libmagick++-dev version from the repositories
$ echo `dpkg -l |grep magick++-dev`
ii libmagick++-dev 7:6.5.7.8-1ubuntu1.1 object-oriented C++ interface to ImageMagick

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

Re: Disable assert/abort

Post by magick »

Its possible this problem is fixed in later versions of ImageMagick. Can you post a URL to your corrupt image. We'll see if we can reproduce the problem-- if so we'll get a patch to fix it.
avejidah
Posts: 3
Joined: 2011-08-16T08:37:42-07:00
Authentication code: 8675308
Contact:

Re: Disable assert/abort

Post by avejidah »

Thanks for the quick response. Grab the corrupt image here: http://busybin.com/corrupt.jpg. Yea yea, I'm goofy lookin' =)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Disable assert/abort

Post by magick »

Classic. All problems are fixed in the release you don't have installed on your system. We tried your Magick++ snippet and the exception was thrown properly and exited without an assertion error:

  • -> magick++
    Caught: Magick: Corrupt JPEG data: 3046 extraneous bytes before marker 0xd9 `corrupt.jpg' @ warning/jpeg.c/JPEGWarningHandler/327

    -> echo "Yeah, it worked"
    Yeah, it worked
    ->
We're using ImageMagick 6.7.1-6.
avejidah
Posts: 3
Joined: 2011-08-16T08:37:42-07:00
Authentication code: 8675308
Contact:

Re: Disable assert/abort

Post by avejidah »

Cool, thanks. Hopefully that version will be added to the Ubuntu repositories at some point. For now, I'll grab it on my dev system. Thanks again!
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests