changeset 3328:f0c92ecd09c8

merge
author Alain Mazy <alain@mazy.be>
date Thu, 21 Mar 2019 11:44:21 +0100
parents 0f17fd02d401 (current diff) 87396c571109 (diff)
children 98cd69135999
files Core/Toolbox.cpp
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Toolbox.cpp	Thu Mar 21 11:42:50 2019 +0100
+++ b/Core/Toolbox.cpp	Thu Mar 21 11:44:21 2019 +0100
@@ -1821,7 +1821,8 @@
       throw OrthancException(ErrorCode_ParameterOutOfRange);
     }
 
-    const uint8_t* buffer = reinterpret_cast<const uint8_t*>(utf8.c_str());
+    assert(sizeof(uint8_t) == sizeof(char));
+    const uint8_t* buffer = reinterpret_cast<const uint8_t*>(utf8.c_str()) + position;
 
     if ((buffer[0] & MASK_IS_1_BYTE) == TEST_IS_1_BYTE)
     {
@@ -1864,7 +1865,7 @@
     else
     {
       // This is not a valid UTF-8 encoding
-      throw OrthancException(ErrorCode_BadFileFormat);
+      throw OrthancException(ErrorCode_BadFileFormat, "Invalid UTF-8 string");
     }
   }
 }