changeset 6152:1639adc016f4 attach-custom-data

queueId and storeId cannot be empty
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 02 Jun 2025 15:49:58 +0200
parents 4d5fad701a17
children 92c5ad130204
files OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp
diffstat 1 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Mon Jun 02 15:40:52 2025 +0200
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Mon Jun 02 15:49:58 2025 +0200
@@ -3338,6 +3338,11 @@
                                                   const void* value,
                                                   size_t valueSize)
   {
+    if (storeId.empty())
+    {
+      throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+
     if (value == NULL &&
         valueSize > 0)
     {
@@ -3377,6 +3382,11 @@
   void StatelessDatabaseOperations::DeleteKeyValue(const std::string& storeId,
                                                    const std::string& key)
   {
+    if (storeId.empty())
+    {
+      throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+
     class Operations : public IReadWriteOperations
     {
     private:
@@ -3405,6 +3415,11 @@
                                                 const std::string& storeId,
                                                 const std::string& key)
   {
+    if (storeId.empty())
+    {
+      throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+
     class Operations : public ReadOnlyOperationsT3<std::string&, const std::string&, const std::string& >
     {
       bool found_;
@@ -3435,6 +3450,11 @@
                                                  const void* value,
                                                  size_t valueSize)
   {
+    if (queueId.empty())
+    {
+      throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+
     if (value == NULL &&
         valueSize > 0)
     {
@@ -3472,6 +3492,11 @@
                                                  const std::string& queueId,
                                                  QueueOrigin origin)
   {
+    if (queueId.empty())
+    {
+      throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+
     class Operations : public IReadWriteOperations
     {
     private:
@@ -3510,6 +3535,11 @@
 
   uint64_t StatelessDatabaseOperations::GetQueueSize(const std::string& queueId)
   {
+    if (queueId.empty())
+    {
+      throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+
     class Operations : public ReadOnlyOperationsT2<uint64_t&, const std::string& >
     {
     public:
@@ -3593,6 +3623,10 @@
     storeId_(storeId),
     limit_(100)
   {
+    if (storeId.empty())
+    {
+      throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
   }
 
   bool StatelessDatabaseOperations::KeysValuesIterator::Next()