From 6d594b5ada117a9515cdf7249ee1dacb9a5f7a61 Mon Sep 17 00:00:00 2001 From: Adriano dos Santos Fernandes Date: Wed, 3 Aug 2022 22:57:53 -0300 Subject: [PATCH] Fix #7243 - Some UNICODE characters can lead to wrong CONTAINING evaluation when lower/upper uses different number of bytes in its encoding. --- src/jrd/intl_classes.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/jrd/intl_classes.h b/src/jrd/intl_classes.h index e7279ab0d4..714f40877e 100644 --- a/src/jrd/intl_classes.h +++ b/src/jrd/intl_classes.h @@ -87,7 +87,10 @@ public: UpcaseConverter(MemoryPool& pool, TextType* obj, const UCHAR*& str, SLONG& len) : PrevConverter(pool, obj, str, len) { - obj->str_to_upper(len, str, len, tempBuffer.getBuffer(len, false)); + const auto charSet = obj->getCharSet(); + const auto bufferSize = len / charSet->minBytesPerChar() * charSet->maxBytesPerChar(); + + len = obj->str_to_upper(len, str, bufferSize, tempBuffer.getBuffer(bufferSize, false)); str = tempBuffer.begin(); }