# HG changeset patch # User Alain Mazy # Date 1553165061 -3600 # Node ID f0c92ecd09c8e62e26d5c31d386f46f03903fc99 # Parent 0f17fd02d40198a3d6390080c33f26285684a975# Parent 87396c571109db869a870f5d44d632ef502a4bc0 merge diff -r 0f17fd02d401 -r f0c92ecd09c8 Core/Toolbox.cpp --- 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(utf8.c_str()); + assert(sizeof(uint8_t) == sizeof(char)); + const uint8_t* buffer = reinterpret_cast(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"); } } }