Mercurial > hg > orthanc
changeset 6674:35a5e25034f4
fix and reduce max sizes on 32 bits system
| author | Alain Mazy <am@orthanc.team> |
|---|---|
| date | Fri, 03 Apr 2026 17:10:42 +0200 |
| parents | 96fb0e7d75ba |
| children | bdc76c0bce7d ce522d548d1c |
| files | OrthancFramework/Sources/DicomFormat/DicomImageInformation.cpp OrthancFramework/Sources/Images/PamReader.cpp |
| diffstat | 2 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 <stdio.h> #include <memory> -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<uint64_t>(std::numeric_limits<size_t>::max()) == 0xFFFFFFFFu + ? static_cast<uint64_t>(1) * 1024 * 1024 * 1024 // 1 GB on 32 bits system + : static_cast<uint64_t>(4) * 1024 * 1024 * 1024); // 4 GiB on 64 bits system + namespace Orthanc {
--- 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 <stdlib.h> // For malloc/free #include <boost/algorithm/string/find.hpp> #include <boost/lexical_cast.hpp> +#include <limits> -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<uint64_t>(std::numeric_limits<size_t>::max()) == 0xFFFFFFFFu + ? static_cast<uint64_t>(1) * 1024 * 1024 * 1024 // 1 GB on 32 bits system + : static_cast<uint64_t>(4) * 1024 * 1024 * 1024); // 4 GiB on 64 bits system + + namespace Orthanc {
