summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-10-14 18:33:10 +0200
committerMarc Mutz <marc.mutz@kdab.com>2017-01-05 15:03:03 +0000
commit0870e670665a702665948723bb7b1eb61a9572a8 (patch)
treed374295b5b493729546d4a47876588d6d3896613
parent33b9fc4e062537a5ab8d4c60c72573f868ab3f13 (diff)
QWbmpHandler: fix integer overflow
Both 'hdr.height' and 'hdr.width' are quint32s. Multiplying them still gives a quint32, but the lhs expected a qint64. Fix by casting one of the operands to qint64. Coverity-Id: 22179 Change-Id: If7385fb42bf994d87ac4e603fa85be4a30ad6d5c Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
-rw-r--r--src/plugins/imageformats/wbmp/qwbmphandler.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/imageformats/wbmp/qwbmphandler.cpp b/src/plugins/imageformats/wbmp/qwbmphandler.cpp
index 0d08422..5fe8ec9 100644
--- a/src/plugins/imageformats/wbmp/qwbmphandler.cpp
+++ b/src/plugins/imageformats/wbmp/qwbmphandler.cpp
@@ -244,7 +244,7 @@ bool WBMPReader::canRead(QIODevice *device)
WBMPHeader hdr;
if (readWBMPHeader(device, &hdr)) {
if ((hdr.type == 0) && (hdr.format == 0)) {
- qint64 imageSize = hdr.height * ((hdr.width + 7) / 8);
+ const qint64 imageSize = hdr.height * ((qint64(hdr.width) + 7) / 8);
qint64 available = device->bytesAvailable();
device->seek(oldPos);
return (imageSize == available);