# HG changeset patch # User Sebastien Jodogne # Date 1553081944 -3600 # Node ID 87396c571109db869a870f5d44d632ef502a4bc0 # Parent a15a4b9d8c0074e7e88e75a9887d344884af40ae fix diff -r a15a4b9d8c00 -r 87396c571109 Core/Toolbox.cpp --- a/Core/Toolbox.cpp Tue Mar 19 09:00:34 2019 +0100 +++ b/Core/Toolbox.cpp Wed Mar 20 12:39:04 2019 +0100 @@ -1818,7 +1818,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) { @@ -1861,7 +1862,7 @@ else { // This is not a valid UTF-8 encoding - throw OrthancException(ErrorCode_BadFileFormat); + throw OrthancException(ErrorCode_BadFileFormat, "Invalid UTF-8 string"); } } }