[Libreoffice-commits] core.git: sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Sun Oct 11 13:42:51 UTC 2020
sw/source/filter/ww8/ww8scan.cxx | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
New commits:
commit 1020191c9772c869a9ac4d83264d35e54e8694c9
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Oct 10 20:38:24 2020 +0100
Commit: Caolán McNamara <caolanm at 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 <caolanm at 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;
}
}
More information about the Libreoffice-commits
mailing list