diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-09-30 17:01:23 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-09-30 19:37:33 +0100 |
commit | 358ca9eaa3d85236047a7a2781e38f57209c2858 (patch) | |
tree | e77572aae5a118624306e436465e5699ce0aa295 /sc/source | |
parent | ac9e7af60bd4e898f921173260bd0e9ebfd0ea34 (diff) |
don't believe xls wrt size to reserve
Change-Id: Id9864f199e270d13d801348b12f1e94dd80558c7
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/filter/excel/xicontent.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index d821a8ad5266..6b0f688a8f9e 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -75,10 +75,15 @@ XclImpSst::XclImpSst( const XclImpRoot& rRoot ) : void XclImpSst::ReadSst( XclImpStream& rStrm ) { rStrm.Ignore( 4 ); - sal_uInt32 nStrCount(0); - nStrCount = rStrm.ReaduInt32(); + sal_uInt32 nStrCount = rStrm.ReaduInt32(); + auto nBytesAvailable = rStrm.GetRecLeft(); + if (nStrCount > nBytesAvailable) + { + SAL_WARN("sc.filter", "xls claimed to have " << nStrCount << " strings, but only " << nBytesAvailable << " bytes available, truncating"); + nStrCount = nBytesAvailable; + } maStrings.clear(); - maStrings.reserve( static_cast< size_t >( nStrCount ) ); + maStrings.reserve(nStrCount); while( (nStrCount > 0) && rStrm.IsValid() ) { XclImpString aString; |