diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-06-19 09:04:10 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-06-19 10:26:50 +0100 |
commit | 9191f44fed1e1ede6a5efcaac6bc92bbe74305ec (patch) | |
tree | d95fecac7535e0dcdc4f106bb23969f2e4924c72 /svtools/source/contnr/imivctl2.cxx | |
parent | 3daec14fd62a6a1655813d26e470513237129263 (diff) |
coverity#706069 Unintended sign extension
Change-Id: I605adc70d054fe3d5aea3bf1984348aae0e7fc28
Diffstat (limited to 'svtools/source/contnr/imivctl2.cxx')
-rw-r--r-- | svtools/source/contnr/imivctl2.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
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<size_t>(nNewGridRows) * nNewGridCols; + bool* pNewGridMap = new bool[nNewCellCount]; + memset(pNewGridMap, 0, nNewCellCount * sizeof(bool)); + size_t nOldCellCount = static_cast<size_t>(_nGridRows) * _nGridCols; + memcpy(pNewGridMap, _pGridMap, nOldCellCount * sizeof(bool)); delete[] _pGridMap; _pGridMap = pNewGridMap; _nGridRows = nNewGridRows; |