diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-04-06 13:32:29 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-04-06 13:37:39 (GMT) |
commit | a70d247d81d2f49faab522af5e4c2a815682c78a (patch) | |
tree | 93736bc3090af16e9c2d19da830968aa34efffbc | |
parent | b2d8bca28e1ea485c9ebbe02566cc099c33d8458 (diff) | |
download | Qt-a70d247d81d2f49faab522af5e4c2a815682c78a.zip Qt-a70d247d81d2f49faab522af5e4c2a815682c78a.tar.gz Qt-a70d247d81d2f49faab522af5e4c2a815682c78a.tar.bz2 |
Fix crash for multiscript text in QTextEngine::boundingBox()
The logClusters pointer is already adjusted for the item, so it should
be indexed relative to the item, hence from 0 to itemLength-1. Adding
pos to the index would give us a random value for all script items > 0.
Thus this would sometimes crash for text that spanned several scripts,
since we would sometimes get a value back which was outside the bounds
of the glyph array.
Task-number: QTBUG-9374
Reviewed-by: Samuel
-rw-r--r-- | src/gui/text/qtextengine.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index b826588..eaa80d3 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1648,7 +1648,7 @@ glyph_metrics_t QTextEngine::boundingBox(int from, int len) const } } - glyph_t glyph = glyphs.glyphs[logClusters[pos + ilen - 1]]; + glyph_t glyph = glyphs.glyphs[logClusters[ilen - 1]]; glyph_metrics_t gi = fe->boundingBox(glyph); if (gi.isValid()) gm.width -= qRound(gi.xoff - gi.x - gi.width); |