summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@theqtcompany.com>2016-02-02 14:06:28 +0100
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2016-02-05 04:14:35 +0000
commite4f71b0cb5e52b4762c4c1d681eff08376e7bc0b (patch)
tree7251f6ea5fd0582a1d951a3378dc6bad89aba784 /tests/auto
parent786d23bb4966b6697ac04c43158e2312d898e133 (diff)
Crash fix: reject certain malformed bmp images
A malformed bmp file header could specify a negative color table size. The bmp handler would then return a QImage that claimed to be valid, but actually was invalid, having an empty color table. This would cause crash later, e.g. when attempting to paint it. Change-Id: I7df7c40867557a82dbcee44c7de061226ff232c0 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/gui/image/qimagereader/images/corrupt_clut.bmpbin0 -> 368 bytes
-rw-r--r--tests/auto/gui/image/qimagereader/tst_qimagereader.cpp1
2 files changed, 1 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qimagereader/images/corrupt_clut.bmp b/tests/auto/gui/image/qimagereader/images/corrupt_clut.bmp
new file mode 100644
index 0000000000..aeb063fce5
--- /dev/null
+++ b/tests/auto/gui/image/qimagereader/images/corrupt_clut.bmp
Binary files differ
diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
index 86dd8c4daf..ff15dc5b6d 100644
--- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
@@ -1482,6 +1482,7 @@ void tst_QImageReader::readCorruptImage_data()
QTest::newRow("corrupt gif") << QString("corrupt.gif") << true << QString("") << QByteArray("gif");
QTest::newRow("corrupt png") << QString("corrupt.png") << true << QString("") << QByteArray("png");
QTest::newRow("corrupt bmp") << QString("corrupt.bmp") << true << QString("") << QByteArray("bmp");
+ QTest::newRow("corrupt bmp (clut)") << QString("corrupt_clut.bmp") << true << QString("") << QByteArray("bmp");
QTest::newRow("corrupt xpm (colors)") << QString("corrupt-colors.xpm") << true
<< QString("QImage: XPM color specification is missing: bla9an.n#x")
<< QByteArray("xpm");