Kaydet (Commit) 0b70e6b9 authored tarafından Caolán McNamara's avatar Caolán McNamara

ofz#3945 Integer-overflow

Change-Id: I3cc8e91078289860d27ee77be3c24eabeb136909
Reviewed-on: https://gerrit.libreoffice.org/44163Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst c4bac944
...@@ -3382,8 +3382,23 @@ void WW8PLCFx_Cp_FKP::GetSprms(WW8PLCFxDesc* p) ...@@ -3382,8 +3382,23 @@ void WW8PLCFx_Cp_FKP::GetSprms(WW8PLCFxDesc* p)
if (nOldEndPos <= nLimitFC) if (nOldEndPos <= nLimitFC)
{ {
p->nEndPos = nCpEnd - bFail = o3tl::checked_sub(nLimitFC, nOldEndPos, nCpLen);
(nLimitFC-nOldEndPos) / (bIsUnicode ? 2 : 1); if (bFail)
{
SAL_WARN("sw.ww8", "broken offset, ignoring");
pPieceIter->SetIdx(nOldPos);
return;
}
nCpLen /= (bIsUnicode ? 2 : 1);
bFail = o3tl::checked_sub(nCpEnd, nCpLen, p->nEndPos);
if (bFail)
{
SAL_WARN("sw.ww8", "broken offset, ignoring");
pPieceIter->SetIdx(nOldPos);
return;
}
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment