Fix crash in positionInLigature
authorJiang Jiang <jiang.jiang@nokia.com>
Fri, 16 Dec 2011 13:21:49 +0000 (14:21 +0100)
committerQt by Nokia <qt-info@nokia.com>
Mon, 2 Jan 2012 15:43:02 +0000 (16:43 +0100)
Check boundary of pos before accessing attributes.

Task-number: QTBUG-23104
Change-Id: I0bc93dbe320badc65acc75bb59b27f481e69b93e
Reviewed-by: Eskil
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
src/gui/text/qtextengine.cpp

index d223b2e..d2c37d4 100644 (file)
@@ -2692,7 +2692,7 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end,
             closestItem--;
         int pos = si->position + clusterStart + closestItem;
         // Jump to the next charStop
-        while (!attrs[pos].charStop && pos < end)
+        while (pos < end && !attrs[pos].charStop)
             pos++;
         return pos;
     }