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 82f88758f2a7309743c473ce976c8a703a09a4c0 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Sep 30 17:01:23 2015 +0100 don't believe xls wrt size to reserve Change-Id: Id9864f199e270d13d801348b12f1e94dd80558c7 (cherry picked from commit 358ca9eaa3d85236047a7a2781e38f57209c2858) Reviewed-on: https://gerrit.libreoffice.org/19042 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@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 3d166cb..9613019 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;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits