summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2021-03-10 15:18:03 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-03-12 11:42:13 +0000
commitf95f872818dc2f2f74c398a3b3188a202ad9e253 (patch)
tree3bd1aa875bc9e5ea4a696932dbaaf2b0b6ee4787
parente41cb4db84357a4824aba1a9a082ea3f181ce1f7 (diff)
Avoid undefined color values in corrupt xpm image
Issue reported by Codechecker. Change-Id: I1a5aa2203fb31e0ce3b630a11e450925aee81fb0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit f651e6a26cb59f7b7c7671cded8a10b9f98f5c71) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/gui/image/qxpmhandler.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index 14823b457e..f5fe6cb7ea 100644
--- a/src/gui/image/qxpmhandler.cpp
+++ b/src/gui/image/qxpmhandler.cpp
@@ -923,7 +923,7 @@ static bool read_xpm_body(
colorMap.insert(xpmHash(QLatin1String(index.constData())), 0);
}
} else {
- QRgb c_rgb;
+ QRgb c_rgb = 0;
if (((buf.length()-1) % 3) && (buf[0] == '#')) {
buf.truncate(((buf.length()-1) / 4 * 3) + 1); // remove alpha channel left by imagemagick
}