sw/source/filter/ww8/ww8par.cxx | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
New commits: commit d7dd13fdc23b535b98da01ba11a695f18378c07f Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Jun 20 17:42:14 2021 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Mon Jun 21 10:54:15 2021 +0200 ofz#34221 avoid OOM Change-Id: I1987d39ea8ff195b397b0ee3fb0e45f9bfbfb572 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117516 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index b98b8bda7f42..d72f51d240f6 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -6091,23 +6091,25 @@ const OUString* SwWW8ImplReader::GetAnnotationAuthor(sal_uInt16 nIdx) m_pAtnNames.reset(new std::vector<OUString>); SvStream& rStrm = *m_pTableStream; - tools::Long nOldPos = rStrm.Tell(); - rStrm.Seek( m_xWwFib->m_fcGrpStAtnOwners ); - - tools::Long nRead = 0, nCount = m_xWwFib->m_lcbGrpStAtnOwners; - while (nRead < nCount && rStrm.good()) + auto nOldPos = rStrm.Tell(); + bool bValidPos = checkSeek(rStrm, m_xWwFib->m_fcGrpStAtnOwners); + if (bValidPos) { - if( m_bVer67 ) - { - m_pAtnNames->push_back(read_uInt8_PascalString(rStrm, - RTL_TEXTENCODING_MS_1252)); - nRead += m_pAtnNames->rbegin()->getLength() + 1; // Length + sal_uInt8 count - } - else + tools::Long nRead = 0, nCount = m_xWwFib->m_lcbGrpStAtnOwners; + while (nRead < nCount && rStrm.good()) { - m_pAtnNames->push_back(read_uInt16_PascalString(rStrm)); - // Unicode: double the length + sal_uInt16 count - nRead += (m_pAtnNames->rbegin()->getLength() + 1)*2; + if( m_bVer67 ) + { + m_pAtnNames->push_back(read_uInt8_PascalString(rStrm, + RTL_TEXTENCODING_MS_1252)); + nRead += m_pAtnNames->rbegin()->getLength() + 1; // Length + sal_uInt8 count + } + else + { + m_pAtnNames->push_back(read_uInt16_PascalString(rStrm)); + // Unicode: double the length + sal_uInt16 count + nRead += (m_pAtnNames->rbegin()->getLength() + 1)*2; + } } } rStrm.Seek( nOldPos ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits