summaryrefslogtreecommitdiff
path: root/sc/source/filter/excel
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-09-30 17:01:23 +0100
committerAndras Timar <andras.timar@collabora.com>2015-10-02 14:58:38 +0200
commiteb6fac3dade6e2da066462345cab8c1eca59c5ca (patch)
treedf8b49829346c5db3a22f2ab35ce2839092abbcc /sc/source/filter/excel
parent5d096341f7318c69eb557dcfcf4f95e0b4b77463 (diff)
don't believe xls wrt size to reserve
(cherry picked from commit 358ca9eaa3d85236047a7a2781e38f57209c2858) Change-Id: Id9864f199e270d13d801348b12f1e94dd80558c7 Reviewed-on: https://gerrit.libreoffice.org/19043 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/filter/excel')
-rw-r--r--sc/source/filter/excel/xicontent.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 79c78ead74c9..bb17b6683867 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);
- rStrm >> nStrCount;
+ 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;