diff Framework/Oracle/GenericOracleRunner.cpp @ 1116:a08699daf78b broker

ParsedDicomFileCache
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 04 Nov 2019 15:54:35 +0100
parents 3730956f41a5
children a8bf81756839
line wrap: on
line diff
--- a/Framework/Oracle/GenericOracleRunner.cpp	Thu Oct 31 18:38:26 2019 +0100
+++ b/Framework/Oracle/GenericOracleRunner.cpp	Mon Nov 04 15:54:35 2019 +0100
@@ -231,6 +231,19 @@
   {
     std::string path = GetPath(root, command.GetPath());
 
+    if (!Orthanc::SystemToolbox::IsRegularFile(path))
+    {
+      throw Orthanc::OrthancException(Orthanc::ErrorCode_InexistentFile);
+    }
+
+    uint64_t fileSize = Orthanc::SystemToolbox::GetFileSize(path);
+
+    // Check for 32bit systems
+    if (fileSize != static_cast<uint64_t>(static_cast<size_t>(fileSize)))
+    {
+      throw Orthanc::OrthancException(Orthanc::ErrorCode_NotEnoughMemory);
+    }
+    
     DcmFileFormat f;
     bool ok;
 
@@ -257,7 +270,7 @@
 
     if (ok)
     {
-      return new ParseDicomFileCommand::SuccessMessage(command, f);
+      return new ParseDicomFileCommand::SuccessMessage(command, f, static_cast<size_t>(fileSize));
     }
     else
     {