From 0870e670665a702665948723bb7b1eb61a9572a8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 14 Oct 2016 18:33:10 +0200 Subject: 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 --- src/plugins/imageformats/wbmp/qwbmphandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/imageformats') 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); -- cgit v1.2.3