diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2017-02-27 14:41:19 +0100 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2017-03-22 14:23:12 +0000 |
commit | 901ed36f3649fc77e5dc4078c0f0e485732feb7a (patch) | |
tree | e27fca3a40e011efb49c175d0116858a2090014c /src | |
parent | 05a71c6c7f0749e10260092f3d3c6aee127b8292 (diff) |
xbm image format: avoid uninitialized pixels for truncated data
xbm bitmaps are conventionally accepted as valid even if there is not
enough data to fill the declared bitmap size: both ImageMagick and
GIMP do this. Qt did too, but the uncovered areas would be
uninitialized, and thus contain random junk bits. This commit adds
clearing of the full QImage data.
Task-number: QTBUG-54169
Change-Id: I84150d54d07dbd546a4947e7ec332f83f2d7ca41
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/image/qxbmhandler.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp index 19015c5dcd..155a4f88b4 100644 --- a/src/gui/image/qxbmhandler.cpp +++ b/src/gui/image/qxbmhandler.cpp @@ -143,6 +143,8 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage) return false; } + outImage->fill(Qt::color0); // in case the image data does not cover the full image + outImage->setColorCount(2); outImage->setColor(0, qRgb(255,255,255)); // white outImage->setColor(1, qRgb(0,0,0)); // black |