summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2012-05-25 06:23:15 +0300
committerQt by Nokia <qt-info@nokia.com>2012-05-25 17:23:20 +0200
commit79ab7c170d8c6b6d3b148f983121717e71fefeea (patch)
tree75e232f6a6b8266c8687e4103790d6397b443b47 /src
parenta755049931031d7e234ba157c960e7cf96489b2a (diff)
Fix potential access beyond the array end
addNextCluster() advances position up to "end" that equals to eng->layoutData->string.length() if current script item is the last one Change-Id: I173286f3002c9c64dd1a89b902958699b6273d68 Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextlayout.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 43d212f394..3cdd54627e 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1865,7 +1865,9 @@ void QTextLine::layout_helper(int maxGlyphs)
addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount,
current, lbh.logClusters, lbh.glyphs);
- if (attributes[lbh.currentPosition].whiteSpace || attributes[lbh.currentPosition-1].lineBreakType != HB_NoBreak) {
+ if (lbh.currentPosition >= eng->layoutData->string.length()
+ || attributes[lbh.currentPosition].whiteSpace
+ || attributes[lbh.currentPosition-1].lineBreakType != HB_NoBreak) {
sb_or_ws = true;
break;
} else if (breakany && attributes[lbh.currentPosition].charStop) {