summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-03-19 21:11:22 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-03-20 13:08:06 +0100
commitf53157835775f976af5bedd9303c91c9d68b80c6 (patch)
treebe0696eeadbd8ced3549a91ad3487d8bc8143d2e /sw
parent3837901ef422d432f709dd95352796a54b58aae6 (diff)
ofz#7026 Integer-overflow
Change-Id: I90928a34ce79903885fe903d69a64dac2eb3e45c Reviewed-on: https://gerrit.libreoffice.org/51593 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 3f7565a1885b..dd2927b29a7f 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -7522,9 +7522,14 @@ void WW8PLCF_HdFt::GetTextPosExact(short nIdx, WW8_CP& rStart, WW8_CP& rLen)
if (nEnd < rStart)
{
SAL_WARN("sw.ww8", "End " << nEnd << " before Start " << rStart);
+ rLen = 0;
return;
}
- rLen = nEnd - rStart;
+ if (o3tl::checked_sub(nEnd, rStart, rLen))
+ {
+ SAL_WARN("sw.ww8", "GetTextPosExact overflow");
+ rLen = 0;
+ }
}
void WW8PLCF_HdFt::UpdateIndex( sal_uInt8 grpfIhdt )