Mercurial > hg > orthanc
diff Core/DicomParsing/FromDcmtkBridge.cpp @ 3772:a11d1d4b5849 transcoding
integration mainline->transcoding
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 17 Mar 2020 19:20:15 +0100 |
parents | 66e18aad0654 74889e6f6d68 |
children | 890af7156f19 |
line wrap: on
line diff
--- a/Core/DicomParsing/FromDcmtkBridge.cpp Tue Mar 17 16:39:38 2020 +0100 +++ b/Core/DicomParsing/FromDcmtkBridge.cpp Tue Mar 17 19:20:15 2020 +0100 @@ -1938,7 +1938,15 @@ std::unique_ptr<DcmFileFormat> result(new DcmFileFormat); result->transferInit(); - if (!result->read(is).good()) + + /** + * New in Orthanc 1.6.0: The "size" is given as an argument to the + * "read()" method. This can avoid huge memory consumption if + * parsing an invalid DICOM file, which can notably been observed + * by executing the integration test "test_upload_compressed" on + * valgrind running Orthanc. + **/ + if (!result->read(is, EXS_Unknown, EGL_noChange, size).good()) { throw OrthancException(ErrorCode_BadFileFormat, "Cannot parse an invalid DICOM file (size: " +