diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-10-14 18:33:10 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2017-02-03 23:07:32 +0000 |
commit | b6ffd71e2315e699d4ad32859cf36c67635820e7 (patch) | |
tree | 81d6182ed5a700e6d85f43eb47d1d6ac950072ac | |
parent | 314ea3029ab9108e51a39b8f038043fd83fefe17 (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>
(cherry picked from commit 0870e670665a702665948723bb7b1eb61a9572a8)
-rw-r--r-- | src/plugins/imageformats/wbmp/qwbmphandler.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/imageformats/wbmp/qwbmphandler.cpp b/src/plugins/imageformats/wbmp/qwbmphandler.cpp index cd9b04a..60538c6 100644 --- a/src/plugins/imageformats/wbmp/qwbmphandler.cpp +++ b/src/plugins/imageformats/wbmp/qwbmphandler.cpp @@ -238,7 +238,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); |