diff options
author | Kevin Funk <kfunk@kde.org> | 2014-08-28 15:46:03 +0200 |
---|---|---|
committer | Kevin Funk <kevin.funk@kdab.com> | 2014-09-02 14:18:08 +0200 |
commit | eb447679456336d387bb69a56c164b06fbe83166 (patch) | |
tree | 6bc3edc6700f126d751a4dedb77cc5b0b9d30a73 /src | |
parent | b9a7cedb6ebd85f249f54c8688943346c7a98260 (diff) |
Fix crash in QTextLayout::cursorToX
When 'cursorPos' is out of bounds ([0, lineEnd]), this method crashed.
Change-Id: Ia0540ab3afbffb5c598f7b8515263cce3b3928e4
Task-number: QTBUG-40753
Reviewed-by: Dominik Haumann <dhaumann@kde.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 4879ae51d7..8e605e4ae1 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2583,7 +2583,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const } int lineEnd = line.from + line.length + line.trailingSpaces; - int pos = *cursorPos; + int pos = qBound(0, *cursorPos, lineEnd); int itm; const QCharAttributes *attributes = eng->attributes(); if (!attributes) { |