summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJohn Tapsell <john.tapsell.ext@basyskom.com>2012-03-14 15:49:07 +0000
committerQt by Nokia <qt-info@nokia.com>2012-04-02 14:52:48 +0200
commit97282527ae7f1c97d6ca3cfeee61c4bacb30832f (patch)
treeed61ba12eeea650f08808a20ece311abd4e93787 /tests
parentc82d40749dc1ce816333e84d7f3232e59fbe2058 (diff)
Harfbuzz-thai - fix buffer overflow when setting item attributes
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> Change-Id: I92de853b57e2e06211193a2b30ac7c308374c961 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
index a88e93c93e..d566f0a20d 100644
--- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
+++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
@@ -105,7 +105,7 @@ private slots:
void thaiIsolatedSaraAm();
void thaiWithZWJ();
-
+ void thaiMultipleVowels();
private:
bool haveTestFonts;
};
@@ -1325,5 +1325,27 @@ void tst_QTextScriptEngine::thaiWithZWJ()
QCOMPARE((bool)e->layoutData->glyphLayout.attributes[i].dontPrint, (i == 1 || i == 3));
}
+void tst_QTextScriptEngine::thaiMultipleVowels()
+{
+ QString s(QString::fromUtf8("ส"));
+ for (int i = 0; i < 100; i++)
+ s += QChar(0x0E47); // Add lots of "VOWEL SIGN MAI TAI KHU N/S-T" stacked on top of the character
+ s += QChar(0x200D); // Now add a zero width joiner (which adds a circle which is hidden)
+ for (int i = 0; i < 100; i++)
+ s += QChar(0x0E47); //Add lots of "VOWEL SIGN MAI TAI KHU N/S-T" stacked on top of the ZWJ
+
+ for (int i = 0; i < 10; i++)
+ s += s; //Repeat the string to make it more likely to crash if we have a buffer overflow
+ QTextLayout layout(s);
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ QTextEngine *e = layout.engine();
+ e->width(0, s.length()); //force itemize and shape
+
+ // If we haven't crashed at this point, then the test has passed.
+}
+
QTEST_MAIN(tst_QTextScriptEngine)
#include "tst_qtextscriptengine.moc"