[Libreoffice-commits] core.git: sc/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Apr 23 18:44:56 UTC 2021
sc/source/filter/excel/xladdress.cxx | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
New commits:
commit e3db0394655127102c3ba144e4de00ba73e83954
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Apr 22 10:22:08 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Apr 23 20:44:04 2021 +0200
cid#1474373 Untrusted loop bound
Change-Id: Id4e7778ffcbeadf53684e5b6814d139e82bcf7e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114555
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/source/filter/excel/xladdress.cxx b/sc/source/filter/excel/xladdress.cxx
index f897a92a70a3..20ef4fa7fc96 100644
--- a/sc/source/filter/excel/xladdress.cxx
+++ b/sc/source/filter/excel/xladdress.cxx
@@ -94,10 +94,21 @@ void XclRangeList::Read( XclImpStream& rStrm, bool bCol16Bit, sal_uInt16 nCountI
nCount = nCountInStream;
else
nCount = rStrm.ReaduInt16();
- size_t nOldSize = mRanges.size();
- mRanges.resize( nOldSize + nCount );
- for( XclRangeVector::iterator aIt = mRanges.begin() + nOldSize; rStrm.IsValid() && (nCount > 0); --nCount, ++aIt )
- aIt->Read( rStrm, bCol16Bit );
+
+ if (!nCount)
+ return;
+
+ XclRange aRange;
+ while (true)
+ {
+ aRange.Read(rStrm, bCol16Bit);
+ if (!rStrm.IsValid())
+ break;
+ mRanges.emplace_back(aRange);
+ --nCount;
+ if (!nCount)
+ break;
+ }
}
void XclRangeList::Write( XclExpStream& rStrm, bool bCol16Bit, sal_uInt16 nCountInStream ) const
More information about the Libreoffice-commits
mailing list