summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2013-06-16 08:28:11 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-11 10:26:33 (GMT)
commit6326b4e622942c701af90e992d7a58f59be41fa2 (patch)
tree227ba46168ab6b820a1e276fb3527d01c825c919 /src/corelib
parentc504d5b8047483e87fd1cfad2c2824353310c5da (diff)
downloadQt-6326b4e622942c701af90e992d7a58f59be41fa2.zip
Qt-6326b4e622942c701af90e992d7a58f59be41fa2.tar.gz
Qt-6326b4e622942c701af90e992d7a58f59be41fa2.tar.bz2
QString::normalize(): Fix assertion in some corner case
Don't assume `from` is 0 and the string always starts with a starter code point. This has been fixed for 5.0 as part of Unicode Data & Algorithms update (qtbase:46b78113b22428e6f8540193fcf0e00591dbd724). Task-number: QTBUG-30931 Change-Id: I2030aaf831ebe619b980e55e98d5f5a366dbe3ed Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qchar.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index 49cc243..fb41026 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -1550,8 +1550,8 @@ static void composeHelper(QString *str, QChar::UnicodeVersion version, int from)
return;
// the loop can partly ignore high Unicode as all ligatures are in the BMP
- int starter = 0;
- int lastCombining = 0;
+ int starter = -2; // to prevent starter == pos - 1
+ int lastCombining = 255; // to prevent combining > lastCombining
int pos = from;
while (pos < s.length()) {
uint uc = s.at(pos).unicode();
@@ -1570,8 +1570,7 @@ static void composeHelper(QString *str, QChar::UnicodeVersion version, int from)
continue;
}
int combining = p->combiningClass;
- if (starter == pos - 1 || combining > lastCombining) {
- Q_ASSERT(starter >= from);
+ if ((starter == pos - 1 || combining > lastCombining) && starter >= from) {
// allowed to form ligature with S
QChar ligature = ligatureHelper(s.at(starter).unicode(), uc);
if (ligature.unicode()) {