changeset 6742:b9752ef08934

cleanup
author Alain Mazy <am@orthanc.team>
date Thu, 07 May 2026 16:52:02 +0200
parents 7318f5f73ace
children 7105e665441a
files OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp OrthancFramework/Sources/Images/ImageAccessor.cpp OrthancFramework/Sources/Images/JpegReader.cpp
diffstat 3 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp	Thu May 07 16:24:20 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp	Thu May 07 16:52:02 2026 +0200
@@ -632,7 +632,7 @@
         if (static_cast<uint64_t>(static_cast<size_t>(frameEnd)) != frameEnd)
         {
           std::ostringstream errorMessage;
-          errorMessage << "ImageDecoder: frameEnd platform overflow (" << frameEnd << ")"; // can only happen on 32 bits
+          errorMessage << "ImageDecoder: frameEnd larger than 4GB, which is too large for Orthanc running in 32bits (" << frameEnd << ")"; // can only happen on 32 bits
           throw OrthancException(ErrorCode_BadFileFormat, errorMessage.str());
         }
 
--- a/OrthancFramework/Sources/Images/ImageAccessor.cpp	Thu May 07 16:24:20 2026 +0200
+++ b/OrthancFramework/Sources/Images/ImageAccessor.cpp	Thu May 07 16:52:02 2026 +0200
@@ -236,7 +236,7 @@
     if (static_cast<uint64_t>(GetBytesPerPixel() * width) > static_cast<uint64_t>(pitch) ||
         static_cast<uint64_t>(static_cast<size_t>(size)) != size)
     {
-      throw OrthancException(ErrorCode_ParameterOutOfRange);
+      throw OrthancException(ErrorCode_ParameterOutOfRange, "Buffer larger than 4GB, which is too large for Orthanc running in 32bits");
     }
   }
 
@@ -264,7 +264,7 @@
     if (static_cast<uint64_t>(GetBytesPerPixel() * width) > static_cast<uint64_t>(pitch) ||
         static_cast<uint64_t>(static_cast<size_t>(size)) != size)
     {
-      throw OrthancException(ErrorCode_ParameterOutOfRange);
+      throw OrthancException(ErrorCode_ParameterOutOfRange, "Buffer larger than 4GB, which is too large for Orthanc running in 32bits");
     }
   }
 
--- a/OrthancFramework/Sources/Images/JpegReader.cpp	Thu May 07 16:24:20 2026 +0200
+++ b/OrthancFramework/Sources/Images/JpegReader.cpp	Thu May 07 16:52:02 2026 +0200
@@ -81,7 +81,7 @@
 
     try
     {
-      content.resize(pitch * cinfo.output_height);
+      content.resize(static_cast<size_t>(totalSize));
     }
     catch (...)
     {
@@ -95,7 +95,7 @@
     while (cinfo.output_scanline < cinfo.output_height) 
     {
       jpeg_read_scanlines(&cinfo, buffer, 1);
-      memcpy(target, buffer[0], pitch);
+      memcpy(target, buffer[0], static_cast<size_t>(pitch));
       target += pitch;
     }