From 4e0b42ea5dad52ba08c5f642a39564bbb2fba994 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Thu, 24 Jun 2021 22:24:34 +0300 Subject: [PATCH] set invalid length variable to the output buffer size in QIcuCodec Signed-off-by: Ivailo Monev --- src/core/codecs/qicucodec.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/codecs/qicucodec.cpp b/src/core/codecs/qicucodec.cpp index 2d2cc0fee..8fd95a1df 100644 --- a/src/core/codecs/qicucodec.cpp +++ b/src/core/codecs/qicucodec.cpp @@ -977,7 +977,7 @@ QString QIcuCodec::convertToUnicode(const char *data, int length, #if 0 error = U_ZERO_ERROR; char errorbytes[10]; - int8_t invalidlen = 0; + int8_t invalidlen = sizeof(errorbytes); ucnv_getInvalidChars(conv, errorbytes, &invalidlen, &error); state->invalidChars = invalidlen; #endif @@ -1008,7 +1008,7 @@ QByteArray QIcuCodec::convertFromUnicode(const QChar *unicode, int length, #if 0 error = U_ZERO_ERROR; char errorbytes[10]; - int8_t invalidlen = 0; + int8_t invalidlen = sizeof(errorbytes); ucnv_getInvalidChars(conv, errorbytes, &invalidlen, &error); state->invalidChars = invalidlen; #endif