I have been tracking down some memory corruption crashes related to loading animated GIFs with OpenSG 2, and I think I have narrowed down at least one cause. The GIF I have been using to cause a crash in the GIF loader itself has two frames of different dimensions where the first is smaller than the second. Valgrind tells me that there is an invalid write to the memory returned by OSG::Image::editData(), and that leads me to believe that the buffer used by OSG::Image is the wrong size.

My current fix for this is to modify the GIF loader so that the width and height passed to OSG::Image::set() come from the GIFStream object rather than from the GIFData object for the first frame. This seems to work because the image reports its width and height as being that of the largest frame. The width and height for the current GIFData still need to be used for reading the bytes for that frame, and I think I am doing that correctly.

Does this sound like a valid approach? I don't know if a patch would be helpful since we're using a version of OpenSG that is about 6 months out of date. I can submit one if it would help clarify what I have described. If nothing else, I have attached a GIF that demonstrates the crash in the GIF loader.

 -Patrick


--
Patrick L. Hartling
Senior Software Engineer, Priority 5
http://www.priority5.com/

The information transmitted in this communication is intended only for
the person or entity to which it is addressed and contains proprietary
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please destroy any copies, contact the sender
and delete the material from any computer.
------------------------------------------------------------------------------
RSA® Conference 2012
Save $700 by Nov 18
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to