changeset 2797:9a0c6a046cc2

Fix handling of incoming C-FIND queries containing Generic Group Length (*, 0x0000)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 16 Aug 2018 10:39:30 +0200
parents 4df3c64402ba
children 5c83e5cf9d79
files Core/DicomParsing/ParsedDicomFile.cpp NEWS
diffstat 2 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Core/DicomParsing/ParsedDicomFile.cpp	Fri Jul 27 16:40:09 2018 +0200
+++ b/Core/DicomParsing/ParsedDicomFile.cpp	Thu Aug 16 10:39:30 2018 +0200
@@ -525,6 +525,13 @@
   void ParsedDicomFile::Clear(const DicomTag& tag,
                               bool onlyIfExists)
   {
+    if (tag.GetElement() == 0x0000)
+    {
+      // Prevent manually modifying generic group length tags: This is
+      // handled by DCMTK serialization
+      return;
+    }
+
     InvalidateCache();
 
     DcmItem* dicom = pimpl_->file_->getDataset();
@@ -612,6 +619,13 @@
                                const Json::Value& value,
                                bool decodeDataUriScheme)
   {
+    if (tag.GetElement() == 0x0000)
+    {
+      // Prevent manually modifying generic group length tags: This is
+      // handled by DCMTK serialization
+      return;
+    }
+
     if (pimpl_->file_->getDataset()->tagExists(ToDcmtkBridge::Convert(tag)))
     {
       throw OrthancException(ErrorCode_AlreadyExistingTag);
@@ -724,6 +738,13 @@
                                 bool decodeDataUriScheme,
                                 DicomReplaceMode mode)
   {
+    if (tag.GetElement() == 0x0000)
+    {
+      // Prevent manually modifying generic group length tags: This is
+      // handled by DCMTK serialization
+      return;
+    }
+
     InvalidateCache();
 
     DcmDataset& dicom = *pimpl_->file_->getDataset();
@@ -756,6 +777,13 @@
                                 bool decodeDataUriScheme,
                                 DicomReplaceMode mode)
   {
+    if (tag.GetElement() == 0x0000)
+    {
+      // Prevent manually modifying generic group length tags: This is
+      // handled by DCMTK serialization
+      return;
+    }
+
     InvalidateCache();
 
     DcmDataset& dicom = *pimpl_->file_->getDataset();
--- a/NEWS	Fri Jul 27 16:40:09 2018 +0200
+++ b/NEWS	Thu Aug 16 10:39:30 2018 +0200
@@ -5,6 +5,7 @@
 * Fix incoming DICOM C-Store filtering for JPEG-LS transfer syntaxes
 * Fix OrthancPluginHttpClient() to return the HTTP status on errors
 * Fix HTTPS requests to sites using a certificate encrypted with ECDSA
+* Fix handling of incoming C-FIND queries containing Generic Group Length (*, 0x0000)
 
 
 Version 1.4.1 (2018-07-17)