Mercurial > hg > orthanc-gdcm
changeset 90:6affa2fc9d39
Prevent transcoding of DICOM images with empty SharedFunctionalGroupsSequence (5200,9229), as this might crash GDCM
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 23 Jul 2024 11:33:14 +0200 (10 months ago) |
parents | 390cb6a49b82 |
children | a06bfd17987e |
files | NEWS Plugin/Plugin.cpp |
diffstat | 2 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Thu May 30 22:14:40 2024 +0200 +++ b/NEWS Tue Jul 23 11:33:14 2024 +0200 @@ -1,6 +1,9 @@ Pending changes in the mainline =============================== +* Prevent transcoding of DICOM images with empty + SharedFunctionalGroupsSequence (5200,9229), as this might crash GDCM + Version 1.7 (2024-05-06) ========================
--- a/Plugin/Plugin.cpp Thu May 30 22:14:40 2024 +0200 +++ b/Plugin/Plugin.cpp Tue Jul 23 11:33:14 2024 +0200 @@ -390,6 +390,13 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented, "Cannot transcode 1bpp DICOM images"); } + gdcm::DataSet ds = reader.GetFile().GetDataSet(); + const gdcm::Tag sfgs(0x5200,0x9229); // SharedFunctionalGroupsSequence + if (ds.FindDataElement(sfgs) && ds.GetDataElement(sfgs).IsEmpty()) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented, "Cannot transcode DICOM images with empty 5200,9229 sequence"); + } + #if !GDCM_VERSION_IS_ABOVE(3, 0, 9) if (reader.GetImage().GetPixelFormat().GetBitsStored() == 16u && syntax == gdcm::TransferSyntax::JPEGExtendedProcess2_4)