# HG changeset patch # User Alain Mazy # Date 1775229042 -7200 # Node ID 35a5e25034f447de281aa257a7a635b3f0958933 # Parent 96fb0e7d75ba84341801c4f738f2ed1892cbea0e fix and reduce max sizes on 32 bits system diff -r 96fb0e7d75ba -r 35a5e25034f4 OrthancFramework/Sources/DicomFormat/DicomImageInformation.cpp --- a/OrthancFramework/Sources/DicomFormat/DicomImageInformation.cpp Fri Apr 03 15:59:27 2026 +0200 +++ b/OrthancFramework/Sources/DicomFormat/DicomImageInformation.cpp Fri Apr 03 17:10:42 2026 +0200 @@ -42,7 +42,10 @@ #include #include -static const uint64_t MAX_FRAME_SIZE = 4ul * 1024ul * 1024ul * 1024ul; // defensive approach: set a reasonable max size for a frame +static const uint64_t MAX_FRAME_SIZE = (static_cast(std::numeric_limits::max()) == 0xFFFFFFFFu + ? static_cast(1) * 1024 * 1024 * 1024 // 1 GB on 32 bits system + : static_cast(4) * 1024 * 1024 * 1024); // 4 GiB on 64 bits system + namespace Orthanc { diff -r 96fb0e7d75ba -r 35a5e25034f4 OrthancFramework/Sources/Images/PamReader.cpp --- a/OrthancFramework/Sources/Images/PamReader.cpp Fri Apr 03 15:59:27 2026 +0200 +++ b/OrthancFramework/Sources/Images/PamReader.cpp Fri Apr 03 17:10:42 2026 +0200 @@ -37,8 +37,13 @@ #include // For malloc/free #include #include +#include -static const uint64_t MAX_PAM_IMAGE_BUFFER_SIZE = 4ul * 1024ul * 1024ul * 1024ul; // defensive approach: set a reasonable max size for a PAM image +static const uint64_t MAX_PAM_IMAGE_BUFFER_SIZE = (static_cast(std::numeric_limits::max()) == 0xFFFFFFFFu + ? static_cast(1) * 1024 * 1024 * 1024 // 1 GB on 32 bits system + : static_cast(4) * 1024 * 1024 * 1024); // 4 GiB on 64 bits system + + namespace Orthanc {