diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-10-10 20:38:24 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-10-11 15:42:17 +0200 |
commit | 1020191c9772c869a9ac4d83264d35e54e8694c9 (patch) | |
tree | 3cf56904f51269e145bb38f9c636c3ac91ac671a /sw | |
parent | e0c1fdcab23dbd2b7a0a7227557d7afc41b49bd7 (diff) |
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@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
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; } } |