diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-11-17 20:32:31 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-11-18 09:08:18 +0000 |
commit | 07ec99d307925b33d13b40d9a0a44ef029025ecc (patch) | |
tree | 3150d4d6af51e61b71ddc467f81fc8ccbbb267e3 /sc/source/filter | |
parent | 5aa174b08489f1f217546966d2396bdf56842dca (diff) |
coverity#1242628 Untrusted loop bound
Change-Id: Ifabdfab76279e4417642ce10cb86a43184b94629
Diffstat (limited to 'sc/source/filter')
-rw-r--r-- | sc/source/filter/excel/xihelper.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx index 6a98771e76be..37e8d0e51166 100644 --- a/sc/source/filter/excel/xihelper.cxx +++ b/sc/source/filter/excel/xihelper.cxx @@ -838,6 +838,16 @@ XclImpCachedMatrix::XclImpCachedMatrix( XclImpStream& rStrm ) : ++mnScRows; } + //assuming worse case scenario of unknown types + const size_t nMinRecordSize = 1; + const size_t nMaxRows = rStrm.GetRecLeft() / (nMinRecordSize * mnScCols); + if (mnScRows > nMaxRows) + { + SAL_WARN("sc", "Parsing error: " << nMaxRows << + " max possible rows, but " << mnScRows << " claimed, truncating"); + mnScRows = nMaxRows; + } + for( SCSIZE nScRow = 0; nScRow < mnScRows; ++nScRow ) for( SCSIZE nScCol = 0; nScCol < mnScCols; ++nScCol ) maValueList.push_back( new XclImpCachedValue( rStrm ) ); |