diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-11-17 20:28:55 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-11-18 09:08:17 +0000 |
commit | 5aa174b08489f1f217546966d2396bdf56842dca (patch) | |
tree | 36c17dcd0216c711181182633d68d570cf642d60 /sc/source/filter | |
parent | 757748180971ee9ecb5feb1bb6364844da9992c0 (diff) |
coverity#1242631 Untrusted loop bound
Change-Id: Ib034582fa4fa6e8149db2e45491230b4900c4d08
Diffstat (limited to 'sc/source/filter')
-rw-r--r-- | sc/source/filter/excel/xilink.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx index 75bf3245deb8..52e8a5ae9141 100644 --- a/sc/source/filter/excel/xilink.cxx +++ b/sc/source/filter/excel/xilink.cxx @@ -634,6 +634,17 @@ XclImpSupbook::XclImpSupbook( XclImpStream& rStrm ) : else if( nSBTabCnt ) { meType = EXC_SBTYPE_EXTERN; + + //assuming all empty strings with just len header of 0 + const size_t nMinRecordSize = sizeof(sal_Int16); + const size_t nMaxRecords = rStrm.GetRecLeft() / nMinRecordSize; + if (nSBTabCnt > nMaxRecords) + { + SAL_WARN("sc", "Parsing error: " << nMaxRecords << + " max possible entries, but " << nSBTabCnt << " claimed, truncating"); + nSBTabCnt = nMaxRecords; + } + for( sal_uInt16 nSBTab = 0; nSBTab < nSBTabCnt; ++nSBTab ) { OUString aTabName( rStrm.ReadUniString() ); |