diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-11-17 20:34:55 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-11-18 09:08:18 +0000 |
commit | 206d68d587ee106c1a51db8507268fdf21fa1ddc (patch) | |
tree | faa657d33716b6e9f45129163b04f8624ffd508e /sc/source/filter/excel | |
parent | 07ec99d307925b33d13b40d9a0a44ef029025ecc (diff) |
coverity#1242538 Untrusted loop bound
Change-Id: I663f70d6324c6dd42208aa3804edfe3680881ea1
Diffstat (limited to 'sc/source/filter/excel')
-rw-r--r-- | sc/source/filter/excel/excform.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index eda413421f82..630997a7d06f 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -1791,6 +1791,16 @@ void ExcelToSc::ReadExtensionArray( unsigned int n, XclImpStream& aIn ) OSL_FAIL( "ExcelToSc::ReadExtensionArray - missing matrix" ); } + //assuming worse case scenario of unknown types + const size_t nMinRecordSize = 1; + const size_t nMaxRows = aIn.GetRecLeft() / (nMinRecordSize * nCols); + if (nRows > nMaxRows) + { + SAL_WARN("sc", "Parsing error: " << nMaxRows << + " max possible rows, but " << nRows << " claimed, truncating"); + nRows = nMaxRows; + } + svl::SharedStringPool& rPool = GetDoc().GetSharedStringPool(); for( nR = 0 ; nR < nRows; nR++ ) { |