summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-06-17 08:43:32 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-06-17 09:08:40 (GMT)
commit8af2f7b5085ee56d289584bddbccc8dead04b9d1 (patch)
treeec946fbb9084d05661ee0887f52ebecde449652f /tests
parenta01ce81cc2d03c64f326af8f5a7f622dc197af7e (diff)
downloadQt-8af2f7b5085ee56d289584bddbccc8dead04b9d1.zip
Qt-8af2f7b5085ee56d289584bddbccc8dead04b9d1.tar.gz
Qt-8af2f7b5085ee56d289584bddbccc8dead04b9d1.tar.bz2
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')
-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 caf9bd3..6d27ef2 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"