diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2014-05-22 02:39:44 +0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-23 12:10:13 +0200 |
commit | be0bfe09ee4b99e9ab45c6898949b5d144e77a29 (patch) | |
tree | 50f7dda7cbcc4a11cfea9be7cbd800908388fe53 /src/gui/text/qtextlayout.cpp | |
parent | 9b3b33b11027d0dd013447c3b59939712c432249 (diff) |
Guarantee QTextEngine::findItem() returns -1 for invalid strPos
...and check the returned value where it may cause undefined behavior
(i.e. negative amount of items or iteration from -1 to n).
Change-Id: Ib7bd9ab178526df45b792ad48b91ebbab6be861a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/gui/text/qtextlayout.cpp')
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 912ab05a59..a48fef7e8b 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1730,6 +1730,7 @@ void QTextLine::layout_helper(int maxGlyphs) int item = -1; int newItem = eng->findItem(line.from); + Q_ASSERT(newItem >= 0); LB_DEBUG("from: %d: item=%d, total %d, width available %f", line.from, newItem, eng->layoutData->items.size(), line.width.toReal()); |