[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sc/qa sc/source
Caolán McNamara
caolanm at redhat.com
Wed Sep 30 14:05:48 PDT 2015
sc/qa/unit/data/xls/pass/crash-1.xls |binary
sc/source/filter/excel/xicontent.cxx | 11 ++++++++---
2 files changed, 8 insertions(+), 3 deletions(-)
New commits:
commit 648a60212c3429ea8b1794247bb4d5fb832e3cc5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Sep 30 17:01:23 2015 +0100
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 at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/qa/unit/data/xls/pass/crash-1.xls b/sc/qa/unit/data/xls/pass/crash-1.xls
new file mode 100644
index 0000000..724bfc1
Binary files /dev/null and b/sc/qa/unit/data/xls/pass/crash-1.xls differ
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 79c78ea..bb17b66 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;
More information about the Libreoffice-commits
mailing list