[Insight-developers] crash in gdcm library

Kent Williams kent at psychiatry.uiowa.edu
Thu Apr 6 13:22:51 EDT 2006


Here is the dataset:
http://www.cornwarning.com/xfer/3DSPGR.tar.gz

If I use the ConvertBetweenFileFormats command to convert the DICOM 
directory, I get these errors. This with CVS Insight and CVS 
InsightApplications, updated today.

gauss 129% ConvertBetweenFileFormats 3DSPGR CBFFImage0.hdr
Not a JPEG file: starts with 0xff 0xc4
Error: In 
/scratch/kent/brains2/iplFreeware/unpackdir/Insight/Utilities/gdcm/src/gdcmJpeg.cxx, 
line 276, function bool 
gdcm::JPEGFragment::ReadJPEGFile16(std::ifstream*, void*, int&)
Serious Problem !


*** glibc detected *** free(): invalid pointer: 0xb703e008 ***
Abort

It looks as though its getting into JPEG decoding by error, after which 
it scrambles all over memory. Here's the valgrind output:

gauss 119% valgrind ConvertBetweenFileFormats 3DSPGR CBFFImage0.hdr
==1124== Memcheck, a memory error detector.
==1124== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==1124== Using LibVEX rev 1471, a library for dynamic binary translation.
==1124== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==1124== Using valgrind-3.1.0, a dynamic binary instrumentation framework.
==1124== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==1124== For more details, rerun with: -v
==1124==
Not a JPEG file: starts with 0xff 0xc4
Error: In 
/scratch/kent/brains2/iplFreeware/unpackdir/Insight/Utilities/gdcm/src/gdcmJpeg.cxx, 
line 276, function bool 
gdcm::JPEGFragment::ReadJPEGFile16(std::ifstream*, void*, int&)
Serious Problem !


==1124== Invalid write of size 1
==1124==    at 0x88A7614: 
gdcm::JPEGFragment::ReadJPEGFile16(std::basic_ifstream<char, 
std::char_traits<char> >*, void*, int&) (gdcmJpeg.cxx:353)
==1124==    by 0x88A45DE: 
gdcm::JPEGFragment::DecompressJPEGFramesFromFile(std::basic_ifstream<char, 
std::char_traits<char> >*, unsigned char*, int, int&) 
(gdcmJPEGFragment.cxx:76)
==1124==    by 0x88A4C2A: 
gdcm::JPEGFragmentsInfo::DecompressFromFile(std::basic_ifstream<char, 
std::char_traits<char> >*, unsigned char*, int, int, int) 
(gdcmJPEGFragmentsInfo.cxx:60)
==1124==    by 0x88AAED7: 
gdcm::PixelReadConvert::ReadAndDecompressJPEGFile(std::basic_ifstream<char, 
std::char_traits<char> >*) (gdcmPixelReadConvert.cxx:532)
==1124==    by 0x88AD444: 
gdcm::PixelReadConvert::ReadAndDecompressPixelData(std::basic_ifstream<char, 
std::char_traits<char> >*) (gdcmPixelReadConvert.cxx:288)
==1124==    by 0x8894524: gdcm::FileHelper::GetRaw() 
(gdcmFileHelper.cxx:1730)
==1124==    by 0x8894776: gdcm::FileHelper::GetImageData() 
(gdcmFileHelper.cxx:393)
==1124==    by 0x87F4D86: itk::GDCMImageIO::Read(void*) 
(itkGDCMImageIO.cxx:244)
==1124==    by 0x837474A: itk::ImageFileReader<itk::Image<short, 3>, 
itk::DefaultConvertPixelTraits<short> >::GenerateData() 
(itkImageFileReader.txx:351)
==1124==    by 0x87E8739: 
itk::ProcessObject::UpdateOutputData(itk::DataObject*) 
(itkProcessObject.cxx:991)
==1124==    by 0x87DB440: itk::DataObject::UpdateOutputData() 
(itkDataObject.cxx:420)
==1124==    by 0x87DB1C1: itk::DataObject::Update() (itkDataObject.cxx:344)
==1124==  Address 0x50C4590 is 0 bytes after a block of size 131,072 alloc'd
==1124==    at 0x4004D29: operator new[](unsigned) (vg_replace_malloc.c:197)
==1124==    by 0x88AA6AF: gdcm::PixelReadConvert::AllocateRaw() 
(gdcmPixelReadConvert.cxx:1302)
==1124==    by 0x88ACD36: 
gdcm::PixelReadConvert::ReadAndDecompressPixelData(std::basic_ifstream<char, 
std::char_traits<char> >*) (gdcmPixelReadConvert.cxx:234)
==1124==    by 0x8894524: gdcm::FileHelper::GetRaw() 
(gdcmFileHelper.cxx:1730)
==1124==    by 0x8894776: gdcm::FileHelper::GetImageData() 
(gdcmFileHelper.cxx:393)
==1124==    by 0x87F4D86: itk::GDCMImageIO::Read(void*) 
(itkGDCMImageIO.cxx:244)
==1124==    by 0x837474A: itk::ImageFileReader<itk::Image<short, 3>, 
itk::DefaultConvertPixelTraits<short> >::GenerateData() 
(itkImageFileReader.txx:351)
==1124==    by 0x87E8739: 
itk::ProcessObject::UpdateOutputData(itk::DataObject*) 
(itkProcessObject.cxx:991)
==1124==    by 0x87DB440: itk::DataObject::UpdateOutputData() 
(itkDataObject.cxx:420)
==1124==    by 0x87DB1C1: itk::DataObject::Update() (itkDataObject.cxx:344)
==1124==    by 0x87E905B: 
itk::ProcessObject::UpdateLargestPossibleRegion() 
(itkProcessObject.cxx:1132)
==1124==    by 0x842DDE5: itk::ImageSeriesReader<itk::Image<short, 3> 
 >::GenerateData() (itkImageSeriesReader.txx:260)
==1124==
==1124== More than 100000 total errors detected.  I'm not reporting any 
more.
==1124== Final error counts will be inaccurate.  Go fix your program!
==1124== Rerun with --error-limit=no to disable this cutoff.  Note
==1124== that errors may occur in your program without prior warning from
==1124== Valgrind, because errors are no longer being displayed.
==1124==
--1124-- INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV) - exiting
--1124-- si_code=1;  Faulting address: 0x10006;  sp: 0x63A66DCC

valgrind: the 'impossible' happened:
   Killed by fatal signal
==1124==    at 0xB001AAC0: swizzle (m_mallocfree.c:306)
==1124==    by 0xB001BCCB: unlinkBlock (m_mallocfree.c:928)
==1124==    by 0xB001C7AC: vgPlain_arena_free (m_mallocfree.c:1110)
==1124==    by 0xB0035387: vgPlain_cli_free (replacemalloc_core.c:108)
==1124==    by 0xB00016F7: die_and_free_mem (mac_malloc_wrappers.c:120)
==1124==    by 0xB0037092: do_client_request (scheduler.c:987)
==1124==    by 0xB0036A3A: vgPlain_scheduler (scheduler.c:721)
==1124==    by 0xB004B173: thread_wrapper (syswrap-linux.c:86)
==1124==    by 0xB004B2A6: run_a_thread_NORETURN (syswrap-linux.c:119)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable
==1124==    at 0x40050A8: free (vg_replace_malloc.c:235)
==1124==    by 0x890ACAF: itk_jpeg16_jpeg_free_small (jmemnobs.c:45)
==1124==    by 0x89026A4: free_pool (jmemmgr.c:1042)
==1124==    by 0x890111C: itk_jpeg16_jpeg_abort (jcomapi.c:41)
==1124==    by 0x88F43CA: itk_jpeg16_jpeg_finish_decompress (jdapimin.c:399)
==1124==    by 0x88A7641: 
gdcm::JPEGFragment::ReadJPEGFile16(std::basic_ifstream<char, 
std::char_traits<char> >*, void*, int&) (gdcmJpeg.cxx:359)
==1124==    by 0x88A45DE: 
gdcm::JPEGFragment::DecompressJPEGFramesFromFile(std::basic_ifstream<char, 
std::char_traits<char> >*, unsigned char*, int, int&) 
(gdcmJPEGFragment.cxx:76)
==1124==    by 0x88A4C2A: 
gdcm::JPEGFragmentsInfo::DecompressFromFile(std::basic_ifstream<char, 
std::char_traits<char> >*, unsigned char*, int, int, int) 
(gdcmJPEGFragmentsInfo.cxx:60)
==1124==    by 0x88AAED7: 
gdcm::PixelReadConvert::ReadAndDecompressJPEGFile(std::basic_ifstream<char, 
std::char_traits<char> >*) (gdcmPixelReadConvert.cxx:532)
==1124==    by 0x88AD444: 
gdcm::PixelReadConvert::ReadAndDecompressPixelData(std::basic_ifstream<char, 
std::char_traits<char> >*) (gdcmPixelReadConvert.cxx:288)
==1124==    by 0x8894524: gdcm::FileHelper::GetRaw() 
(gdcmFileHelper.cxx:1730)
==1124==    by 0x8894776: gdcm::FileHelper::GetImageData() 
(gdcmFileHelper.cxx:393)
==1124==    by 0x87F4D86: itk::GDCMImageIO::Read(void*) 
(itkGDCMImageIO.cxx:244)
==1124==    by 0x837474A: itk::ImageFileReader<itk::Image<short, 3>, 
itk::DefaultConvertPixelTraits<short> >::GenerateData() 
(itkImageFileReader.txx:351)
==1124==    by 0x87E8739: 
itk::ProcessObject::UpdateOutputData(itk::DataObject*) 
(itkProcessObject.cxx:991)
==1124==    by 0x87DB440: itk::DataObject::UpdateOutputData() 
(itkDataObject.cxx:420)
==1124==    by 0x87DB1C1: itk::DataObject::Update() (itkDataObject.cxx:344)
==1124==    by 0x87E905B: 
itk::ProcessObject::UpdateLargestPossibleRegion() 
(itkProcessObject.cxx:1132)
==1124==    by 0x842DDE5: itk::ImageSeriesReader<itk::Image<short, 3> 
 >::GenerateData() (itkImageSeriesReader.txx:260)
==1124==    by 0x87E8739: 
itk::ProcessObject::UpdateOutputData(itk::DataObject*) 
(itkProcessObject.cxx:991)
==1124==    by 0x87DB440: itk::DataObject::UpdateOutputData() 
(itkDataObject.cxx:420)
==1124==    by 0x87E83D4: 
itk::ProcessObject::UpdateOutputData(itk::DataObject*) 
(itkProcessObject.cxx:940)
==1124==    by 0x87DB440: itk::DataObject::UpdateOutputData() 
(itkDataObject.cxx:420)
==1124==    by 0x87DB1C1: itk::DataObject::Update() (itkDataObject.cxx:344)
==1124==    by 0x87E905B: 
itk::ProcessObject::UpdateLargestPossibleRegion() 
(itkProcessObject.cxx:1132)
==1124==    by 0x83B28CC: itk::ImageFileWriter<itk::Image<short, 3> 
 >::Write() (itkImageFileWriter.txx:182)
==1124==    by 0x837B1C7: itk::ImageFileWriter<itk::Image<short, 3> 
 >::Update() (itkImageFileWriter.h:144)
==1124==    by 0x83C3F0E: void 
ReadDicomSeriesCastWriteImage<itk::Image<short, 3>, itk::Image<short, 3> 
 >(std::string, std::string) (castconverthelpers.h:141)
==1124==    by 0x8377925: DicomFileConverterScalar(std::string const&, 
std::string const&, std::string const&, std::string const&, int) 
(castconvertDicomScalar.cxx:67)
==1124==    by 0x835D307: main (castconvert.cxx:304)


Note: see also the FAQ.txt in the source distribution.
It contains workarounds to several common problems.

If that doesn't help, please report this bug to: www.valgrind.org

In the bug report, send all the above text, the valgrind
version, and what Linux distro you are using.  Thanks.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.itk.org/mailman/private/insight-developers/attachments/20060406/ff3666ca/attachment.html


More information about the Insight-developers mailing list