From 870c4e7b9ce6143ae48f717265094d4f7e0d2434 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 16 Dec 2011 14:21:49 +0100 Subject: Fix crash in positionInLigature Check boundary of pos before accessing attributes. Task-number: QTBUG-23104 Reviewed-by: Eskil --- src/gui/text/qtextengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index ee2eef6..66773c6 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2805,7 +2805,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; } -- cgit v0.12