# HG changeset patch # User Sebastien Jodogne # Date 1748593819 -7200 # Node ID d0c769a39095cbe67d9d9c078e8e4f4b573e912a # Parent 9dfe76cb26ea4f48197ebe924588628a5406754b safeguard for 32bit architectures diff -r 9dfe76cb26ea -r d0c769a39095 Sources/StorageArea.cpp --- a/Sources/StorageArea.cpp Fri Jan 17 13:45:23 2025 +0100 +++ b/Sources/StorageArea.cpp Fri May 30 10:30:19 2025 +0200 @@ -114,6 +114,11 @@ const void *content, int64_t size) { + if (static_cast(static_cast(size)) != size) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, "Buffer larger than 4GB, which is too large for Orthanc running in 32bits"); + } + boost::filesystem::path path = GetPathInternal(root_, uuid); if (boost::filesystem::exists(path.parent_path())) @@ -131,7 +136,7 @@ } } - Orthanc::SystemToolbox::WriteFile(content, size, path.string(), false); + Orthanc::SystemToolbox::WriteFile(content, static_cast(size), path.string(), false); }