[Insight-users] bug in MetaUtils.cxx

Stefan Klein s.klein at erasmusmc.nl
Wed Nov 5 10:10:42 EST 2008


Hi all,

When saving small mhd images with compression, my program crashes 
sometimes. It occurs when the compressed data buffer is LARGER than the 
uncompressed data buffer. Obviously, this odd situation normally only 
occurs with very small images.

Attached is an example program. Can anybody reproduce this bug? On my 
computer, using Windows XP 32 bit, MS visual C++ 2008 Express, ITK 3.8 
the program crashes. Using the latest ITK version, the program does not 
crash, but creates a corrupt mhd, which cannot be read anymore.

I could reproduce the bug on a Linux 64 bit system with gcc 4.1.2.

The source of the error seems to lie in MetaUtils.cxx, lines 673-737. A 
buffer with length of the input buffer is allocated. When the output 
buffer becomes larger (z.total_out), the problem initiates. On my 
computer, the crash took place in MetaImage.cxx, line 1756, when the 
compressed data buffer memory is deleted.

Kind regards,
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bugtestsrc.zip
Type: application/x-zip-compressed
Size: 1993 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20081105/fd1760bd/attachment.bin>


More information about the Insight-users mailing list