sw/source/filter/ww8/ww8scan.cxx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
New commits: commit 1020191c9772c869a9ac4d83264d35e54e8694c9 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Oct 10 20:38:24 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sun Oct 11 15:42:17 2020 +0200 split out check to function Change-Id: Ie4b2fc5c871e57d782f801b1ae6a72b9f0ac2dd3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104177 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index dfa8fe9d4a5e..1b3c738823bd 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -5169,6 +5169,19 @@ void WW8PLCFMan::RestoreAllPLCFx( const WW8PLCFxSaveAll& rSave ) m_aD[i].Restore( rSave.aS[n++] ); } +namespace +{ + bool IsSizeLegalCheckSize(long nSprmLen, sal_Int32 nSprmsLen) + { + if (nSprmLen > nSprmsLen) + { + SAL_WARN("sw.ww8", "Short sprm, len " << nSprmLen << " claimed, max possible is " << nSprmsLen); + return false; + } + return true; + } +} + void WW8PLCFMan::GetSprmStart( short nIdx, WW8PLCFManResult* pRes ) const { memset( pRes, 0, sizeof( WW8PLCFManResult ) ); @@ -5196,9 +5209,8 @@ void WW8PLCFMan::GetSprmStart( short nIdx, WW8PLCFManResult* pRes ) const { // Length of actual sprm pRes->nMemLen = maSprmParser.GetSprmSize(pRes->nSprmId, pRes->pMemPos, p->nSprmsLen); - if (pRes->nMemLen > p->nSprmsLen) + if (!IsSizeLegalCheckSize(pRes->nMemLen, p->nSprmsLen)) { - SAL_WARN("sw.ww8", "Short sprm, len " << pRes->nMemLen << " claimed, max possible is " << p->nSprmsLen); pRes->nSprmId = 0; } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits