comparison 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
comparison
equal deleted inserted replaced
3770:66e18aad0654 3772:a11d1d4b5849
1936 is.setEos(); 1936 is.setEos();
1937 1937
1938 std::unique_ptr<DcmFileFormat> result(new DcmFileFormat); 1938 std::unique_ptr<DcmFileFormat> result(new DcmFileFormat);
1939 1939
1940 result->transferInit(); 1940 result->transferInit();
1941 if (!result->read(is).good()) 1941
1942 /**
1943 * New in Orthanc 1.6.0: The "size" is given as an argument to the
1944 * "read()" method. This can avoid huge memory consumption if
1945 * parsing an invalid DICOM file, which can notably been observed
1946 * by executing the integration test "test_upload_compressed" on
1947 * valgrind running Orthanc.
1948 **/
1949 if (!result->read(is, EXS_Unknown, EGL_noChange, size).good())
1942 { 1950 {
1943 throw OrthancException(ErrorCode_BadFileFormat, 1951 throw OrthancException(ErrorCode_BadFileFormat,
1944 "Cannot parse an invalid DICOM file (size: " + 1952 "Cannot parse an invalid DICOM file (size: " +
1945 boost::lexical_cast<std::string>(size) + " bytes)"); 1953 boost::lexical_cast<std::string>(size) + " bytes)");
1946 } 1954 }