changeset 5877:ff0b54e8bc71

Fix deadlock when parsing specific invalid DICOM files
author Alain Mazy <am@orthanc.team>
date Thu, 21 Nov 2024 12:51:26 +0100
parents 3ed63202eff8
children e08438a558b0
files NEWS OrthancFramework/Sources/DicomFormat/DicomStreamReader.cpp
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Tue Nov 12 18:03:34 2024 +0100
+++ b/NEWS	Thu Nov 21 12:51:26 2024 +0100
@@ -29,7 +29,8 @@
 * Fix C-Find queries not returning private tags in the modality worklist plugin.
 * Fix extremely rare error when 2 threads are trying to create the same folder in the File Storage 
   at the same time.
-* Fix crashes if handling very large images
+* Fix crashes if handling very large images.
+* Fix deadlock when parsing specific invalid DICOM files.
 * Metrics:
   - fix a few metrics that were not published
   - added 2 metrics: orthanc_storage_cache_miss_count & orthanc_storage_cache_hit_count 
--- a/OrthancFramework/Sources/DicomFormat/DicomStreamReader.cpp	Tue Nov 12 18:03:34 2024 +0100
+++ b/OrthancFramework/Sources/DicomFormat/DicomStreamReader.cpp	Thu Nov 21 12:51:26 2024 +0100
@@ -247,6 +247,10 @@
           
         pos += length + 12;
       }
+      else
+      {
+        throw OrthancException(ErrorCode_BadFileFormat, "Invalid DICOM File: Unable to parse Meta Header");
+      }
     }
 
     if (pos != block.size())