[Gdcm-hackers] [ gdcm-Bugs-3414704 ] JPEG2000Codec::GetHeaderInfo crash, NULL deref, 2.0.18
Cross-platform DICOM implementation
Brought to you by:
malat
From: SourceForge.net <no...@so...> - 2012-06-19 08:06:43
|
Bugs item #3414704, was opened at 2011-09-27 13:55 Message generated for change (Comment added) made by malat You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=739587&aid=3414704&group_id=137895 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: ITK Group: 2.0.19 Status: Open Resolution: Invalid Priority: 5 Private: No Submitted By: Sean McBride (sean_mcbride) Assigned to: Mathieu Malaterre (malat) Summary: JPEG2000Codec::GetHeaderInfo crash, NULL deref, 2.0.18 Initial Comment: My app uses GDCM 2.0.18 via ITK. It is crashing trying to open 3E768EB7.dcm from the gdcm test data. Backtrace: #0 0x1018041cc in gdcm::JPEG2000Codec::GetHeaderInfo at gdcmJPEG2000Codec.cxx:1226 #1 0x10177d6e4 in gdcm::Bitmap::TryJPEG2000Codec at gdcmBitmap.cxx:666 #2 0x10177fd8f in gdcm::Bitmap::GetBufferInternal at gdcmBitmap.cxx:839 #3 0x10177fe2e in gdcm::Bitmap::ComputeLossyFlag at gdcmBitmap.cxx:643 #4 0x1017ad460 in gdcm::PixmapReader::ReadImage at gdcmPixmapReader.cxx:1044 #5 0x1017b1d0b in gdcm::ImageReader::ReadImage at gdcmImageReader.cxx:59 #6 0x1017ad785 in gdcm::PixmapReader::Read at gdcmPixmapReader.cxx:90 #7 0x1017b1991 in gdcm::ImageReader::Read at gdcmImageReader.cxx:54 #8 0x101794ea6 in gdcm::SerieHelper::AddFileName at gdcmSerieHelper.cxx:139 #9 0x10179516d in gdcm::SerieHelper::SetDirectory at gdcmSerieHelper.cxx:130 #10 0x1007593d8 in itk::GDCMSeriesFileNames::SetInputDirectory at itkGDCMSeriesFileNames.cxx:80 #11 0x100466aed in itk::GDCMSeriesFileNames::SetDirectory at itkGDCMSeriesFileNames.h:76 The responsible code is: case J2K_CFMT: j2k = (opj_j2k_t*)dinfo->j2k_handle; assert( j2k ); reversible = j2k->cp->tcps->tccps->qmfbid; The problem is that 'cp' is NULL. I guess some extra NULL checks are needed! :) This repros when 3E768EB7.dcm is in the same folder as all the other files, but does not repro if it is in a folder alone. I guess this is because SetDirectory() is examining all the other DICOM files in the folder. ---------------------------------------------------------------------- >Comment By: Mathieu Malaterre (malat) Date: 2012-06-19 01:06 Message: $ gdcminfo --version gdcminfo: gdcm 2.2.0 $Date$ $ gdcminfo --check-compression ../gdcm/Testing/Data/D_CLUNIE_CT1_J2KI.dcm MediaStorage is 1.2.840.10008.5.1.4.1.1.2 [CT Image Storage] TransferSyntax is 1.2.840.10008.1.2.4.91 [JPEG 2000 Image Compression] NumberOfDimensions: 2 Dimensions: (512,512,1) SamplesPerPixel :1 BitsAllocated :16 BitsStored :16 HighBit :15 PixelRepresentation:1 ScalarType found :INT16 PhotometricInterpretation: MONOCHROME2 PlanarConfiguration: 0 TransferSyntax: 1.2.840.10008.1.2.4.91 Origin: (-158.136,-179.036,-75.7) Spacing: (0.661468,0.661468,1) DirectionCosines: (1,0,0,0,1,0) Rescale Intercept/Slope: (-1024,1) Orientation Label: AXIAL Encapsulated Stream was found to be: lossy I simply cannot reproduce your bug... ---------------------------------------------------------------------- Comment By: Sean McBride (sean_mcbride) Date: 2012-04-03 14:20 Message: Mathieu, My coworker has debugged this more... We were able to find the file that causes the failure: D_CLUNIE_CT1_J2KI.dcm. And the problem repros with this file all alone in its own folder. gdcminfo versions 2.0.18, 2.0.19, and 2.2.0 all fail when given this file. Using TOT from git, it works. So it looks like something got fixed. Does this ring any bells? Thanks. ---------------------------------------------------------------------- Comment By: Sean McBride (sean_mcbride) Date: 2012-02-21 08:00 Message: Mathieu, any news on this? We just got a crash report from a customer with this exact backtrace. So it's not just theoretical, people do seem to sometimes keep mixed series files all in the same folder. ---------------------------------------------------------------------- Comment By: Sean McBride (sean_mcbride) Date: 2012-01-09 08:28 Message: Mathieu, are you saying you cannot repro? I guess the problem stems from the fact that there are so many different kinds of DICOM files all in the same folder. Remember that SetDirectory examines most/all of the files in the folder, it's probably assuming they all use the same kind of compression or something. As I said, this repros when 3E768EB7.dcm is in the same folder as all the other files, but does not repro if it is in a folder alone. ---------------------------------------------------------------------- Comment By: Mathieu Malaterre (malat) Date: 2011-12-29 08:55 Message: Hi Sean, I fail to see how this code can ever be executed. 3E768EB7.dcm is JPEG Lossless, how in the world could the JPEG2000 codec ever be called ? Thanks ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=739587&aid=3414704&group_id=137895 |