summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtextlayout
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-06-17 10:43:32 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-06-17 11:08:40 +0200
commit8af2f7b5085ee56d289584bddbccc8dead04b9d1 (patch)
treeec946fbb9084d05661ee0887f52ebecde449652f /tests/auto/qtextlayout
parenta01ce81cc2d03c64f326af8f5a7f622dc197af7e (diff)
Fix possible crash in QTextLayout for glyphless items
Change e1915815bc5ef86b3844608bba46769da5173363 moved part of the right bearing check out of the "non-whitespace-or-object" block of the layout, which could potentially cause crashes for layouts that contained items that were line separators or tabs etc. because we would access the logical clusters array based on the position of e.g. the tab even though it didn't have an entry. This could potentially give us an arbitrary index which might cause an out of bounds when accessing the glyphs array. Task-number: QTBUG-11427 Reviewed-by: Simon Hausmann
Diffstat (limited to 'tests/auto/qtextlayout')
-rw-r--r--tests/auto/qtextlayout/tst_qtextlayout.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index caf9bd3f00..6d27ef24f9 100644
--- a/tests/auto/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp
@@ -110,6 +110,7 @@ private slots:
void longText();
void widthOfTabs();
void columnWrapWithTabs();
+ void glyphLessItems();
// QTextLine stuff
void setNumColumnsWrapAtWordBoundaryOrAnywhere();
@@ -1319,6 +1320,24 @@ void tst_QTextLayout::lineWidthFromBOM()
// Don't spin into an infinite loop
}
+void tst_QTextLayout::glyphLessItems()
+{
+ {
+ QTextLayout layout;
+ layout.setText("\t\t");
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+ }
+
+ {
+ QTextLayout layout;
+ layout.setText(QString::fromLatin1("AA") + QChar(QChar::LineSeparator));
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+ }
+}
QTEST_MAIN(tst_QTextLayout)
#include "tst_qtextlayout.moc"