[GEM-dev] [ pd-gem-Bugs-3521302 ] pix_write and pix_buffe crash when writing a file fail

SourceForge.net noreply at sourceforge.net
Fri Apr 27 15:53:54 CEST 2012

Bugs item #3521302, was opened at 2012-04-25 02:27
Message generated for change (Comment added) made by nusmuk
You can respond by visiting: 

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Pixes (pix_ objects)
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Cyrille Henry (nusmuk)
Assigned to: Nobody/Anonymous (nobody)
Summary: pix_write and pix_buffe crash when writing a file fail

Initial Comment:
pix_write and pix_buffer crash when triing to write an image file in a non existant directory.
tested with GEM git from 2012 04 24 on linux

GEM: image saving support: jpeg magick tiff

tested with both jpeg and tiff file saving.


>Comment By: Cyrille Henry (nusmuk)
Date: 2012-04-27 06:53

git update did not change anything.
i'm using ubuntu 10.04, libmagick++-dev version is : 7:

here is a backtrace :
#0  0x00007ffff7108a75 in raise () from /lib/libc.so.6
#1  0x00007ffff710c5c0 in abort () from /lib/libc.so.6
#2  0x00007ffff7101941 in __assert_fail () from /lib/libc.so.6
#3  0x00007fffe59a200a in LockSemaphoreInfo () from
#4  0x00007fffe59357e1 in DestroyExceptionInfo () from
#5  0x00007fffe595310d in DestroyImage () from /usr/lib/libMagickCore.so.2
#6  0x00007fffe595c9e8 in DestroyImageList () from
#7  0x00007fffe5cf619e in Magick::ImageRef::~ImageRef() () from
#8  0x00007fffe5cebc5d in Magick::Image::~Image() () from
#9  0x00007fffe5f1ec82 in gem::plugins::imageMAGICK::save (this=<value
optimized out>, image=..., filename=<value optimized out>, mimetype=<value
optimized out>, props=<value optimized out>) at MagickPlusPlus.cpp:105
#10 0x00007fffef0cbc3a in gem::plugins::imagesaverMeta::save(imageStruct
const&, std::string const&, std::string const&, gem::Properties const&) ()
from ./Gem.pd_linux
#11 0x00007fffef0757f8 in mem2image (image=<value optimized out>,
filename=0x7fffe0110fb8 "/aa/pix_test00000.jpg", type=<value optimized
out>) at ImageSave.cpp:51
#12 0x00007fffef28cd83 in pix_write::doWrite (this=0x7fffe0110f10) at
#13 0x00007fffef0a908a in GemBase::gem_renderMess (this=0x7fffe0110f10,
cache=<value optimized out>, state=0x7fffffffe150) at GemBase.cpp:154
#14 0x0000000000467021 in pd_typedmess (x=0x7fffe0110ed0, s=<value
optimized out>, argc=<value optimized out>, argv=0xffffffffffffffff) at
#15 0x000000000046a40a in outlet_anything (x=<value optimized out>,
s=0x751050, argc=2, argv=0x7fffffffdf90) at m_obj.c:418
#16 0x00007fffef0f1a91 in gemhead::renderGL (this=0x7fffe0110c80,
state=0x7fffffffe150) at gemhead.cpp:160
#17 0x00007fffef0f4d37 in gemreceive::proxyCallback (p=<value optimized
out>, s=0x751050, argc=2, argv=0x7fffffffe0f0) at gemreceive.cpp:284
#18 0x0000000000466e6b in pd_typedmess (x=0x7fffe0110da0, s=<value
optimized out>, argc=<value optimized out>, argv=0xffffffffffffffff) at
#19 0x00007fffef076eac in GemMan::renderChain (s=0x7fffe0110cf0,
state=<value optimized out>) at Manager.cpp:500
#20 0x00007fffef077a4a in GemMan::render () at Manager.cpp:782
#21 0x00000000004772b9 in sched_tick () at m_sched.c:372
#22 m_pollingscheduler () at m_sched.c:482
#23 m_mainloop () at m_sched.c:568
#24 0x00007ffff70f3c4d in __libc_start_main () from /lib/libc.so.6
#25 0x0000000000412be9 in _start ()


Comment By: IOhannes m zmölnig (zmoelnig)
Date: 2012-04-27 06:29

that is weird.
i found a bug in imageJPEG that would indeed crash Gem whenever saving
failed (the mixed jpeg-62 and jpeg-80 system was only another problem that
triggered the abort; the fix in Gem's git  493e28ee0aef9cd should fix all
those problems)

if there is indeed a problem with imageMAGICK as well, please provide full
information about your installed ImageMagick as well as a backtrace


Comment By: Cyrille Henry (nusmuk)
Date: 2012-04-27 06:23


i did have only libjpeg-62 install on my computer.

removing gem_imageJPEG.so and gem_imageJPEG.la file did not solve the
The probleme was solved removing gem_imageMAGICK.*, but that disable png
image loading suport.


Comment By: IOhannes m zmölnig (zmoelnig)
Date: 2012-04-26 04:17

i could confirm the crash but noticed, that i have two different libjpeg
installations on my harddisk:
- libjpeg-62 headers in /usr/local/include (but not corresponding
libjpeg.so in /usr/local/lib - only a .a)
- libjpeg-80 headers in /usr/include AND libjpeg-80 libjpeg.so in

this resulted in imageJPEG being compiled against jpeg-62 headers, but
being linked with jpeg-80.
trying to write a file would abort (rather than crash) with a message
"Wrong JPEG library version: library is 80, caller expects 62"

once i removed the jpeg-62 headers and compiled Gem using the correct
jpeg-80 headers, everything works as expected (loading works as well, which
was not the case when using the mixed system (though it didn't abort))

could this be the same for you?

i haven't yet found a way to check the jpeg library version at runtime, in
order to prevent the abort.


Comment By: IOhannes m zmölnig (zmoelnig)
Date: 2012-04-26 03:57

afaict,  the imageJPEG backend causes the crash;
until the problem is fixed, you could try running Gem without imageJPEG
support (imageMAGICK will provide jpeg loading/saving anyhow)


You can respond by visiting: 

More information about the GEM-dev mailing list