diff options
author | Ritt Konstantin <ritt.ks@gmail.com> | 2010-05-20 08:46:10 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-05-20 08:46:10 (GMT) |
commit | 8e5ac76a2907a7a89b31ed562b5d086adaad5faf (patch) | |
tree | 6852eae5d09b5f2223c14a26f11b8efa097ec8da /src | |
parent | 8b3efa13709b24b5bc5d6356d8c8d94f06209fd5 (diff) | |
download | Qt-8e5ac76a2907a7a89b31ed562b5d086adaad5faf.zip Qt-8e5ac76a2907a7a89b31ed562b5d086adaad5faf.tar.gz Qt-8e5ac76a2907a7a89b31ed562b5d086adaad5faf.tar.bz2 |
fix canonicalOrderHelper() for some corner case
where string ends with sequence like HiS, LowS, NotS.
in this case, if combiningClass(HiS, LowS) > combiningClass(NotS),
then result will be invalid due to early exit on (p2 >= s.length()-1)
Merge-request: 2393
Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qchar.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index 29ecf10..c3e9f0e 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -1567,20 +1567,20 @@ static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, in int p2 = pos+1; uint u1 = s.at(pos).unicode(); if (QChar(u1).isHighSurrogate()) { - ushort low = s.at(pos+1).unicode(); + ushort low = s.at(p2).unicode(); if (QChar(low).isLowSurrogate()) { - p2++; u1 = QChar::surrogateToUcs4(u1, low); if (p2 >= l) break; + ++p2; } } uint u2 = s.at(p2).unicode(); - if (QChar(u2).isHighSurrogate() && p2 < l-1) { + if (QChar(u2).isHighSurrogate() && p2 < l) { ushort low = s.at(p2+1).unicode(); if (QChar(low).isLowSurrogate()) { - p2++; u2 = QChar::surrogateToUcs4(u2, low); + ++p2; } } |