summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2020-05-29 15:15:01 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-06-02 09:21:20 +0000
commit33c98d8fffc726c1e178d2293d11fcd34f336006 (patch)
treec7023f6372a79a06719c2244ecaf6834250f53a6 /src
parent26dc7f012a62d3744f194650af6b15412ac864ae (diff)
bmp/ico decoder: fail early for unsupported bit depths
All the normal bit depths are supported, so no point in trying to go through the decoding code path for others. Avoids wide bitshift warning for claimed depths > 32. Change-Id: I61b72dbbf9558ca28db46f8168339f8174e56997 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit 6a2224fd58414a78957104dd654f697c4b2eaa1d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/gui/image/qbmphandler.cpp6
-rw-r--r--src/plugins/imageformats/ico/qicohandler.cpp6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp
index 7257853c3e..396bb1964e 100644
--- a/src/gui/image/qbmphandler.cpp
+++ b/src/gui/image/qbmphandler.cpp
@@ -262,9 +262,13 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset,
depth = 8;
format = QImage::Format_Indexed8;
break;
- default:
+ case 1:
depth = 1;
format = QImage::Format_Mono;
+ break;
+ default:
+ return false;
+ break;
}
if (depth != 32) {
diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp
index 4908850cc5..701da0c06e 100644
--- a/src/plugins/imageformats/ico/qicohandler.cpp
+++ b/src/plugins/imageformats/ico/qicohandler.cpp
@@ -491,8 +491,12 @@ QImage ICOReader::iconAt(int index)
case 4:
icoAttrib.depth = 8;
break;
- default:
+ case 1:
icoAttrib.depth = 1;
+ break;
+ default:
+ return img;
+ break;
}
if (icoAttrib.depth == 32) // there's no colormap
icoAttrib.ncolors = 0;