From 9191f44fed1e1ede6a5efcaac6bc92bbe74305ec Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 19 Jun 2014 09:04:10 +0100 Subject: coverity#706069 Unintended sign extension Change-Id: I605adc70d054fe3d5aea3bf1984348aae0e7fc28 --- svtools/source/contnr/imivctl2.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'svtools/source/contnr/imivctl2.cxx') diff --git a/svtools/source/contnr/imivctl2.cxx b/svtools/source/contnr/imivctl2.cxx index f19ef08d6f45..0c48a7cda6f4 100644 --- a/svtools/source/contnr/imivctl2.cxx +++ b/svtools/source/contnr/imivctl2.cxx @@ -557,9 +557,11 @@ void IcnGridMap_Impl::Expand() else nNewGridCols += 50; - bool* pNewGridMap = new bool[nNewGridRows*nNewGridCols]; - memset( pNewGridMap, 0, nNewGridRows * nNewGridCols * sizeof(bool) ); - memcpy( pNewGridMap, _pGridMap, _nGridRows * _nGridCols * sizeof(bool) ); + size_t nNewCellCount = static_cast(nNewGridRows) * nNewGridCols; + bool* pNewGridMap = new bool[nNewCellCount]; + memset(pNewGridMap, 0, nNewCellCount * sizeof(bool)); + size_t nOldCellCount = static_cast(_nGridRows) * _nGridCols; + memcpy(pNewGridMap, _pGridMap, nOldCellCount * sizeof(bool)); delete[] _pGridMap; _pGridMap = pNewGridMap; _nGridRows = nNewGridRows; -- cgit