# HG changeset patch # User Alain Mazy # Date 1721727194 -7200 # Node ID 6affa2fc9d39077af0ea416a2b41d8de5f985ffe # Parent 390cb6a49b829b7ee3059f2f2c1667456eabb023 Prevent transcoding of DICOM images with empty SharedFunctionalGroupsSequence (5200,9229), as this might crash GDCM diff -r 390cb6a49b82 -r 6affa2fc9d39 NEWS --- 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) ======================== diff -r 390cb6a49b82 -r 6affa2fc9d39 Plugin/Plugin.cpp --- 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)