summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-09-06 15:44:08 (GMT)
committerMarc Mutz <marc.mutz@kdab.com>2016-09-09 17:22:45 (GMT)
commit78bc427395116bfaf3d99134f42aec5310020f8e (patch)
treecd14d5c3354210a8b61cf3f7183a461c458f3512
parent1ffd91a8a0c7ddb901b3c91f0f5e475811994e59 (diff)
downloadqtsvg-78bc427395116bfaf3d99134f42aec5310020f8e.tar.gz
Fix UB (signed overflow) in QSvgIconEnginePrivate::pmcKey()
Found by UBsan: qsvgiconengine.cpp:64:84: runtime error: left shift of 537133056 by 4 places cannot be represented in type 'int' Fix by casting to qint64 at the start of the shift-or chain. The total cumulative shift is by 28 places, so 64 bits should be enough to not overflow anymore. Change-Id: Ia37bc98c5af67a4de10fb9807addd369110f36d2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp
index 086f5a9..0a01abe 100644
--- a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp
+++ b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp
@@ -61,7 +61,7 @@ public:
QString pmcKey(const QSize &size, QIcon::Mode mode, QIcon::State state)
{ return QLatin1String("$qt_svgicon_")
+ QString::number(serialNum, 16).append(QLatin1Char('_'))
- + QString::number((((((size.width()<<11)|size.height())<<11)|mode)<<4)|state, 16); }
+ + QString::number((((((qint64(size.width()) << 11) | size.height()) << 11) | mode) << 4) | state, 16); }
void stepSerialNum()
{ serialNum = lastSerialNum.fetchAndAddRelaxed(1); }