changeset 6746:999f1b613bf0

fix
author Alain Mazy <am@orthanc.team>
date Fri, 08 May 2026 13:04:56 +0200
parents e0454c1f0a1b
children 6e2c28b976b4
files OrthancFramework/Sources/DicomFormat/StreamBlockReader.cpp
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/StreamBlockReader.cpp	Fri May 08 12:21:41 2026 +0200
+++ b/OrthancFramework/Sources/DicomFormat/StreamBlockReader.cpp	Fri May 08 13:04:56 2026 +0200
@@ -75,7 +75,7 @@
          * "DicomStreamReader::LookupPixelDataOffset()" for buffers)
          **/
         
-        size_t remainingBytes = std::max(block_.size() - blockPos_, static_cast<size_t>(std::numeric_limits<std::streamsize>::max())); // avoid overflowing std::streamsize
+        size_t remainingBytes = std::min(block_.size() - blockPos_, static_cast<size_t>(std::numeric_limits<std::streamsize>::max())); // avoid overflowing std::streamsize
         stream_.read(&block_[blockPos_], static_cast<std::streamsize>(remainingBytes));
         
         std::streamsize r = stream_.gcount();