summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-06-07 12:10:01 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-06-11 12:33:09 +0000
commit5c0cb9346bdb3e8d48d0e85c0b7a904c9571118a (patch)
tree4374c4646acdb022ae75a1c44aa4775e8ae78bd2 /src
parent557677186a7d7f415be1597e1a0317a4150b525f (diff)
Hangul composition: use < base + count checks, not <= checks
Before Unicode 4.1.0 there was an error in the example code for Hangul normalization that used <= on the ends of some ranges of values, where they should have used < tests. This was faithfully copied but the need for correction has only lately come to light. Thanks to Ma Lin for pointing this out and providing the fix and test-cases. Fixes: QTBUG-71894 Change-Id: I5c7fec1f9fac1f7a25b2d5e9c3109a90a7ff49e1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 182afbe335a8bd494a86defc5d32da3ae8ec7920) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/text/qchar.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/text/qchar.cpp b/src/corelib/text/qchar.cpp
index dcc36d18ce..5a2ff34228 100644
--- a/src/corelib/text/qchar.cpp
+++ b/src/corelib/text/qchar.cpp
@@ -1885,7 +1885,7 @@ inline bool operator<(const UCS2SurrogatePair &ligature, uint u1)
static uint inline ligatureHelper(uint u1, uint u2)
{
- if (u1 >= Hangul_LBase && u1 <= Hangul_SBase + Hangul_SCount) {
+ if (u1 >= Hangul_LBase && u1 < Hangul_SBase + Hangul_SCount) {
// compute Hangul syllable composition as per UAX #15
// hangul L-V pair
const uint LIndex = u1 - Hangul_LBase;
@@ -1898,7 +1898,7 @@ static uint inline ligatureHelper(uint u1, uint u2)
const uint SIndex = u1 - Hangul_SBase;
if (SIndex < Hangul_SCount && (SIndex % Hangul_TCount) == 0) {
const uint TIndex = u2 - Hangul_TBase;
- if (TIndex <= Hangul_TCount)
+ if (TIndex < Hangul_TCount && TIndex)
return u1 + TIndex;
}
}