Fix crash when encoding CJK characters from UTF-16 into UTF-8

#4180
This commit is contained in:
2026-07-13 14:48:25 +02:00
parent 9952d6cbf8
commit 7c986a3a09
+2 -1
View File
@@ -86,7 +86,8 @@ public:
StringAsUTF8(const Char* text, int32 length)
{
int32 lengthUtf8;
if (length + 1 < InlinedSize)
// UTF-8 can use up to 3 bytes per UTF-16 code unit
if (length * 3 + 1 < InlinedSize)
{
StringUtils::ConvertUTF162UTF8(text, this->_inlined, length, lengthUtf8);
this->_inlined[lengthUtf8] = 0;