summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 1b24c6686aad..a561a702f324 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -1300,7 +1300,17 @@ WW8_CP WW8PLCFx_PCD::AktPieceStartFc2Cp( WW8_FC nStartPos )
if (nStartPos >= nFcEnd)
nStartPos = nFcEnd - (1 * nUnicodeFactor);
- return nCpStart + (nStartPos - nFcStart) / nUnicodeFactor;
+ WW8_FC nFcDiff = (nStartPos - nFcStart) / nUnicodeFactor;
+
+ WW8_FC nCpRet;
+ bFail = o3tl::checked_add(nCpStart, nFcDiff, nCpRet);
+ if (bFail)
+ {
+ SAL_WARN("sw.ww8", "broken offset, ignoring");
+ return WW8_CP_MAX;
+ }
+
+ return nCpRet;
}
// Helper routines for all