diff options
author | Andy Shaw <andy.shaw@digia.com> | 2015-01-05 14:26:03 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@digia.com> | 2015-01-07 09:42:32 +0100 |
commit | bb16ceac6871a9096547f5170ff174e87a605437 (patch) | |
tree | 8ddd89186a4b66d2e26fb34151e557e3c662a899 /tests | |
parent | 5517d1fde55ee3d4601b4a47543d846467b4d267 (diff) |
Prevent buffer overrun when getting the glyph images
The change 35bc3dc45aacaf36a8bdfccc7627136cc2e5b185 moved some padding out
of QTextureGlyphCache into the font engines directly, however this was not
done for the DirectWrite font engine so it caused a buffer overrun.
Task-number: QTBUG-41782
Change-Id: I4e643159036f06c5edd8a742dc6694d517a47826
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index c5755dcdad..41ceebb646 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -289,7 +289,7 @@ private slots: void blendARGBonRGB(); void RasterOp_NotDestination(); - + void drawTextNoHinting(); private: void fillData(); void setPenColor(QPainter& p); @@ -4812,6 +4812,21 @@ void tst_QPainter::RasterOp_NotDestination() QCOMPARE(pixel, 0xff00ffff); } +void tst_QPainter::drawTextNoHinting() +{ + { + QImage image(250, 250, QImage::Format_RGB32); + QPainter p(&image); + QFont font("Arial", 8); + font.setHintingPreference(QFont::PreferNoHinting); + font.setStyleStrategy(QFont::PreferAntialias); + p.setFont(font); + p.drawText(image.rect(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"); + } + // Testing for a crash when DirectWrite is used on Windows + QVERIFY(true); +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" |