# HG changeset patch # User Alain Mazy # Date 1638446584 -3600 # Node ID b83d2fc2fce18cb7f8419488b0ce1f9d7d7ac9b2 # Parent 76bb4f16907238aad6848ebad02730bea965842c Show an error message when trying to send studies > 4GB via STOW-RS diff -r 76bb4f169072 -r b83d2fc2fce1 .hgignore --- a/.hgignore Mon Aug 30 18:12:52 2021 +0200 +++ b/.hgignore Thu Dec 02 13:03:04 2021 +0100 @@ -4,3 +4,4 @@ *.cpp.orig *.h.orig *~ +.vscode/ diff -r 76bb4f169072 -r b83d2fc2fce1 NEWS --- a/NEWS Mon Aug 30 18:12:52 2021 +0200 +++ b/NEWS Thu Dec 02 13:03:04 2021 +0100 @@ -2,6 +2,7 @@ =============================== * Detection of windowing and rescale in ".../rendered" for Philips multiframe images +* Show an error message when trying to send studies > 4GB via STOW-RS Version 1.6 (2021-05-07) diff -r 76bb4f169072 -r b83d2fc2fce1 Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp --- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Mon Aug 30 18:12:52 2021 +0200 +++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Thu Dec 02 13:03:04 2021 +0100 @@ -3,6 +3,7 @@ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium * Copyright (C) 2017-2021 Osimis S.A., Belgium + * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -539,6 +540,13 @@ const std::string& password) { Clear(); + + if (body.size() > 0xffffffffu) + { + LogError("Cannot handle body size > 4GB"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + return CheckHttp(OrthancPluginHttpPost(GetGlobalContext(), &buffer_, url.c_str(), body.c_str(), body.size(), username.empty() ? NULL : username.c_str(), @@ -552,6 +560,13 @@ const std::string& password) { Clear(); + + if (body.size() > 0xffffffffu) + { + LogError("Cannot handle body size > 4GB"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + return CheckHttp(OrthancPluginHttpPut(GetGlobalContext(), &buffer_, url.c_str(), body.empty() ? NULL : body.c_str(), body.size(), @@ -1892,6 +1907,12 @@ ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); } + if (body.size() > 0xffffffffu) + { + LogError("Cannot handle body size > 4GB"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + OrthancPlugins::MemoryBuffer answer; uint16_t status; OrthancPluginErrorCode code = OrthancPluginCallPeerApi @@ -1920,6 +1941,12 @@ ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); } + if (body.size() > 0xffffffffu) + { + LogError("Cannot handle body size > 4GB"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + OrthancPlugins::MemoryBuffer answer; uint16_t status; OrthancPluginErrorCode code = OrthancPluginCallPeerApi @@ -2883,6 +2910,12 @@ MemoryBuffer answerBodyBuffer, answerHeadersBuffer; + if (body.size() > 0xffffffffu) + { + LogError("Cannot handle body size > 4GB"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + OrthancPluginErrorCode error = OrthancPluginHttpClient( GetGlobalContext(), *answerBodyBuffer,