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>
This commit is contained in:
Konstantin Ritt 2012-05-25 06:23:15 +03:00 committed by Qt by Nokia
parent a755049931
commit 79ab7c170d

View File

@ -1865,7 +1865,9 @@ void QTextLine::layout_helper(int maxGlyphs)
addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount, addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount,
current, lbh.logClusters, lbh.glyphs); 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; sb_or_ws = true;
break; break;
} else if (breakany && attributes[lbh.currentPosition].charStop) { } else if (breakany && attributes[lbh.currentPosition].charStop) {